Re: Memory leak in 2.0.33 ??

Linus Torvalds (torvalds@transmeta.com)
Tue, 23 Dec 1997 13:22:01 -0800 (PST)


On Tue, 23 Dec 1997, Benjamin C.R. LaHaise wrote:
>
> I wonder if he might be seeing another bug I came across in all recent
> kernels - kswapd will not swap out any shared privately mapped pages.

Uhhuh, that's a long-standing one that I'm nervous about changing. The
problem is the "privately" part - if the page really is private then
everything is ok, but a shared dirty page we cannot write out to multiple
places because that would "unshare" it.

You are probably right that the particular piece of code can only happen
for private pages, but I'll really have to think long and hard on that
part.

> (1) will only be true for privately mapped pages. Let's say a big process
> like inn does a fork(). Now you have a nice chunk of memory that will
> never be swapped out until the region is unmapped. This behaviour is
> normally masked by the fork() then exec() nature of most applications.

Right. That will fix up any dirty COW pages. Can we absolutely guarantee
that there are no dirty shared pages when we reach point (2)?

> Linus: could you comment on this?

I'd like to apply the patch, but I'd really like to be absolutely sure it
cannot ever result in "disassociating" a page that really _is_ shared (not
just COW) between two processes..

Linus