Re: swsusp performance problems in 2.6.15-rc3-mm1

From: Andy Isaacson
Date: Tue Dec 06 2005 - 13:14:39 EST


On Tue, Dec 06, 2005 at 01:18:35PM +0100, Pavel Machek wrote:
> > I'm assuming that the difference is that with Rafael's patches, clean
> > pages that would have been evicted in the "freeing pages..." step are
> > now being written out to the swsusp image. If so, this is a waste - no
> > point in having the data on disk twice. (It would be nice to confirm
> > this suspicion.)
>
> Confirmed. But you are wrong; it is not a waste. The pages are nicely
> linear in suspend image, while they would be all over the disk
> otherwise. There can easily be factor 20 difference between linear
> read and random read.

Agreed, linear reads are obviously an enormous improvement over seeking
all over the disk. (Especially given my 15 ms seek latency.) It would
suck to have to do all those seeks synchronously (before allowing the
swsusp resume to complete). But see below for my suggested alternative.

> > Could we rework it to avoid writing clean pages out to the swsusp image,
> > but keep a list of those pages and read them back in *after* having
> > resumed? Maybe do the /dev/initrd ('less +/once Documentation/initrd.txt'
> > if you're not familiar with it) trick to make the list of pages available
> > to a userland helper.
>
> I did not understand this one.

I'm suggesting that rather than writing the clean pages out to the
image, simply make their metadata available to a post-resume userland
helper. Something like

% head -2 /dev/swsusp-helper
/bin/sh 105-115 192 199-259
/lib/libc-2.3.2.so 1-250

where the userland program is expected to use the list of page numbers
(and getpagesize(2)) to asynchronously page in the working set in an
ionice'd manner.

This doesn't get rid of the seeks, of course, but doing them post-resume
will improve interactive performance while avoiding the cost of gigantic
swsusp images.

> Anyway, try limiting size of image to ~500MB, first. Should solve your
> problem with very little work.

This is obviously the right thing for my situation, and it's on my list.

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