Re: patch cow-swapin [was Re: Very bad swap bug -- 2.0, 2.1 at least]

Rik van Riel (H.H.vanRiel@phys.uu.nl)
Wed, 23 Sep 1998 21:40:31 +0200 (CEST)


On Wed, 23 Sep 1998, Andrea Arcangeli wrote:
> On Tue, 15 Sep 1998, Simon Kirby wrote:
>
> >This swap bug that I mentioned a while back is still happening, and this
>
> It' s a bit late but I' m happy because I think to have finally fixed
> the problem pretty well (and right) here.

I'm experiencing the problem right now... It's not
serious, but it _does_ hamper performance for the
application concerned.

> It' s a bit difficult to explain with _English_ words the cause of the
> problem. In short you have a process that has touched some of its .data
> area and then it never used it anymore so such data got swapped out. Then
> the .text (in RAM) of that process run a fork() and the child process
> start touching again the old swapped out data that so has to be swapped in
> but the parent process don' t know that such data is been swapped in and
> so, if it will fork again, the new child will swapin again.

Looking at the particular thing running right now (a
very-very-very-often forking shell script) your theory
seems to be right... Excellent detective work!

It certainly looks like this bug is going to be a very
serious performance problem with Apache web servers.
Consider the case where the parent server got pushed
out to swap in a low-web-load situation. This means that
the 'serving' routines are now not in memory.

Now each time the server forks it is creating a child
process with "serving routine not in memory", while in
fact it is... This means that the kernel will keep
swapping/paging in the particular piece of data needed!

While Andrea's patch might look a bit inefficient, I'm
pretty sure that the cost incurred by the tests will
be more than made up for in increased performance...

I really think that this patch should go (after some
reviews and testing) into the 2.1 tree, as we don't
want such a serious performance bug in the 2.2 kernel.

Rik.
+-------------------------------------------------------------------+
| Linux memory management tour guide. H.H.vanRiel@phys.uu.nl |
| Scouting Vries cubscout leader. http://www.phys.uu.nl/~riel/ |
+-------------------------------------------------------------------+

-
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.tux.org/lkml/