Re: [PATCH] vm - swap_prefetch-15

From: Con Kolivas
Date: Fri Oct 07 2005 - 07:19:30 EST


On Fri, 7 Oct 2005 21:46, Paolo Ciarrocchi wrote:
> On 10/6/05, Con Kolivas <kernel@xxxxxxxxxxx> wrote:
> > The last known bugs were addressed in this latest version of the swap
> > prefetching patch. Thanks to the testers out there who helped it get this
> > far.
> >
> > -Prefetched pages weren't handled properly by the lru lists.
> > -Prefetch groups are now 10 times larger when laptop_mode is enabled thus
> > decreasing the amount of time spent prefetching and thus the disk
> > spinning. -Documentation as suggested by Ingo Oeser
> >
> > Incremental patches and latest available here:
> > http://ck.kolivas.org/patches/swap-prefetch/
>
> Ciao Con,
> i downloading right now kernel 2.6.14-rc3 and your latest patch (v15),
> in the weekend I'll update my Ubuntu platform and I'll like to compare
> performance of vanilla vs vm-swap_prefetch.

Great!

> Any hint about what kind of instrumentation I could use in order to
> get interesting and useful numbers ?

To get some useful advantage from it you have to have a workload that swaps on
your hardware in the first place. I have a simple mechanism to induce it
reliably where I open a few large applications concurrently - browser and
office suite come to mind, then create my swap load:

tail -f /dev/zero

works real nice. Either let it run to completion and hope that tail gets
oom-killed or ctrl-c it after you've used up half your swapspace.
Then I usually let vmstat 1 run in the background. Leave the machine for 5 or
10 minutes and do simple wallclock time from the moment you click on the
application till it is available. Try changing swap_prefetch from 2 to 0
in /proc/sys/vm/swap_prefetch to compare the difference. This is a very
coarse and somewhat contrived example, but even in real world settings where
you hit swapspace during normal usage it is slowly trickling in in the
background and I find it makes a noticeable difference.

If you watch vmstat with swap_prefetch enabled, you'll notice it doing SI of
256KB (at default setting of swap_prefetch==2) every second when the machine
is very idle. Then after all the pages have been prefetched, when you click
on the application you shouldn't see anything in SI at all implying no swap
in. You can see how many entries are currently in the prefetch swaplist
easily enough with
cat /proc/slabinfo | grep swapped_entry

where the first numeric column of active objects shows the number of pages in
the list (not all of them will result in a swapped in page).

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