Re: a patch that might help on small-memory machines (was Re: 2.1 MM [was: Re: 2.2 will never come..

Kevin Buhr (buhr@stat.wisc.edu)
14 Jul 1998 09:48:32 -0500


Andrea Arcangeli <arcangeli@mbox.queen.it> writes:
>
> Now I applyed the right patch and it perform in the same way. I have not
> the /proc sysctl and I had to reset again after cp /tmp/zero /dev/null.

To save bandwidth, let's call this bug the "cp-bug".

First, my patch wasn't meant to address the cp-bug. It was meant to
address the "dying of memory fragmentation" problem whereby forks
eventually start failing. This condition is typically terminal,
preventing small-memory machines from staying up more than a few days.
Sorry if we got our wires crossed about what this patch was supposed
to do.

What's happening with the cp-bug, as I understand it, is that your "cp
/tmp/zero /dev/null" is mapping in pages and pages of "/tmp/zero", and
these pages are being treated as being almost as important as code
pages. Typically, this is wrong, since most file pages are much less
likely to be reused than code pages.

In *some* sense, my patch makes the cp-bug worse, since it gets rid of
the weird code Bill Hawes was using to free dcache entries for the
sole purpose of getting their pages unmapped. (IMHO, it's not the
dcache's job to free up the page cache.) However, for your particular
trigger command "cp /tmp/zero /dev/null", the patch should have no
effect, since the "/tmp/zero" dentry isn't going to be freed while
it's in use, even will Bill's code.

Second, the "pagecache" and "buffermem" settings I use make the cp-bug
quite a bit worse in some situtations, since they reduce the fast
"page borrowing" that Linus was testing in "do_try_to_free_page".

*I* find my "pagecache" and "buffermem" settings helpful because I
frequently commit the heinous crime of running emacs with the memory
hog known as Gnus. Because this rutting pig has a working set of some
5 megs, the default "10 30 75" settings in "pagecache" usually end up
giving away valuable emacs code pages to other files because of the
cp-bug. Since I'm not usually copying big files, that particular
version of the cp-bug doesn't bother me much. Of course, when I run
"tar xfz linux-2.1.108.tar.gz", "emacs" (and everything else) becomes
unusable as every code page on the system is traded for pages of
"linux-2.1.108.tar.gz", but such is life.

Ingo and Stephen, help me out here. Am I so full of (!) that I squeak
when I walk, or have I got things essentially right?

Kevin <buhr@stat.wisc.edu>

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html