Re: Page cache and swapping

Jim Nance (jlnance@avanticorp.com)
Tue, 1 Jul 1997 08:24:25 -0400 (EDT)


Hi Mark,
Thanks for the excellent description of how the all this works.

> Dirty named pages (file pages) are written to disk when they are
> unmapped(), msync()ed, or reaped via swap_out().
> swap_out() uses the "age" of a page to determine what to reap, so the
> dirty-pages you refer to are not always being written to disk.

This is exactly what I would want to happen. However, as far as I can tell
large amounts of disk I/O are taking place. I thought that perhaps
I was accidently calling mmap() with MAP_PRIVATE instead of MAP_SHARED, so
I ran the program with strace attached to see what it was doing. It looks
like a library 'feature'. It seems that qsort() calls mmap() itself and
maps a region slightly larger than the input data. This is why the
program spends so much time swapping. That explains the behavior I am
seeing. I wish qsort did not do this, but at least I understand what is
going on now. Of course this program
(http://sailboat.acs.uncwil.edu/~jlnance/mapsort/mapsort.c) still causes
the 2.1.43 kernel to crash, so that is still an unexplained bug.

Thanks again,

Jim