Messages in this thread | | | From | Thomas Schlichter <> | Subject | Re: [RFC] first try for swap prefetch | Date | Sat, 12 Apr 2003 07:05:05 +0200 |
| |
On April 1, Andrew Morton wrote: > Thomas Schlichter <schlicht@uni-mannheim.de> wrote: > > > you can just do > > > > > > if (radix_tree_delete(...) != -ENOENT) > > > list_del(...) > > > > > > + read_swap_cache_async(entry); > > > > Sorry, but I think I can not. The list_del() needs the value returned by > > radix_tree_lookup(), so I can not kick it... > > OK, I'll change radix_tree_delete() to return the deleted object address if > it was found, else NULL. That's a better API.
That's right, I like it better that way, too! Thank you for the patch!
> > Do you know how expensive the radix_tree_lookup() is? O(1) or O(log(n))?? > > For my shame I do not really know that data structure... :-( > > It is proportional to > > log_base_64(largest index which the tree has ever stored) > > log_base_64: because each node has 64 slots. Each time maxindex grows by a > factor of 64 we need to introduce a new level. > > "largest index ever": because we do not (and cannot feasibly) reduce the > height when items are removed.
Thanks for the detailed answer.
> > > It might make sense to poke the speculative swapin code in the > > > page-freeing path too. > > > > I wanted to do this but don't know which function is the correct one for > > this. But I will search harder... or can you give me a hint? > > free_pages_bulk() would probably suit.
I don't think so, as this is part of the buddy allocator which controls the usage of the physical memory. Now I've implemented following:
1. Add an entry when a page is removed by the kswapd. 2. Remove the entry when the page is added to the page_cache. 3. Remove the entry when the page is removed from the page_cache.
So with point 3 I cover the freeing of the pages. But as the kswapd calls the function from 3, too, I do the 1st point after kswapd did do point3...
To finish my second (and surely better) try I just need one more information...
How can I get the file pointer for a buffered page with the information available in the kswapd (minly the page struct)??
This is very importand because, as described above, I extract the needed information for my prefetch daemon in the kswapd. My daemon needs the file pointer to be able to load the buffer pages with the page_cache_read() function from the mm/filemap.c file.
I'm sorry if I bother you...
Best regards Thomas[unhandled content-type:application/pgp-signature] | |