Re: [RFC] first try for swap prefetch

From: Thomas Schlichter (schlicht@uni-mannheim.de)
Date: Sat Apr 12 2003 - 00:05:05 EST


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


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Apr 15 2003 - 22:00:26 EST