Re: ~500 megs cached yet 2.6.5 goes into swap hell

Andrew Morton
2004-04-29T02:41:56Z

Andrew Morton <akpm@osdl.org> wrote:
>
> Paul Mackerras <paulus@samba.org> wrote:
> >
> ...
> > What I have noticed with 2.6.6-rc1 on my dual G5 is that if I rsync a
> > gigabyte or so of data over to another machine, it then takes several
> > seconds to change focus from one window to another. I can see it
> > slowly redraw the window title bars. It looks like the window manager
> > is getting swapped/paged out.
> >
> > This machine has 2.5GB of ram, so I really don't see why it would need
> > to swap at all. There should be plenty of page cache pages that are
> > clean and not in use by any process that could be discarded. It seems
> > like as soon as there is any memory shortage at all it picks on the
> > window manager and chucks out all its pages. :(
> >
>
> I suspect rsync is taking two passes across the source files for its
> checksumming thing. If so, this will defeat the pagecache use-once logic.
> The kernel sees the second touch of the pages and assumes that there will
> be a third touch.

OK, a bit of fiddling does indicate that if a file is present on both
client and server, and is modified on the client, the rsync client will
indeed touch the pagecache pages twice. Does this describe the files which
you're copying at all?

One thing you could do is to run `watch -n1 cat /proc/meminfo'. Cause lots
of memory to be freed up then do the copy. Monitor the size of the active
and inactive lists. If the active list is growing then we know that rsync
is touching pages twice.

That would be an unfortunate special-case.