Re: [RFC] first try for swap prefetch

Andrew Morton (akpm@digeo.com)
Thu, 10 Apr 2003 16:18:26 -0700


Thomas Schlichter <schlicht@uni-mannheim.de> wrote:
>
> Hi,
>
> as mentioned a few days ago I was going to try to implement a swap prefetch to
> better utilize the free memory. Now here is my first try.

That's surprisingly cute. Does it actually do anything noticeable?

+ swapped_entry = kmalloc(sizeof(*swapped_entry), GFP_ATOMIC);

These guys will need a slab cache (not SLAB_HW_CACHE_ALIGNED) to save space.

+ swapped_entry = radix_tree_lookup(&swapped_root.tree, entry.val);
+ if(swapped_entry) {
+ list_del(&swapped_entry->list);
+ radix_tree_delete(&swapped_root.tree, entry.val);

you can just do

if (radix_tree_delete(...) != -ENOENT)
list_del(...)

+ read_swap_cache_async(entry);

What you want here is a way of telling if the disk(s) which back the swap are
idle. We used to have that, but Hugh deleted it. It can be put back, but
it's probably better to put a `last_read_request_time' and
`last_write_request_time' into struct backing_dev_info. If nobody has used
the disk in the past N milliseconds, then start the speculative swapin.

It might make sense to poke the speculative swapin code in the page-freeing
path too.

And to put the speculatively-swapped-in pages at the tail of the inactive
list (perhaps).

But first-up, some demonstrated goodness is needed...

-
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/