Re: Anticipatory prefaulting in the page fault handler V2

From: Andi Kleen
Date: Thu Dec 16 2004 - 02:29:26 EST


Christoph Lameter <clameter@xxxxxxx> writes:
>
> If a fault occurred for page x and is then followed by page x+1 then it may
> be reasonable to expect another page fault at x+2 in the future. If page
> table entries for x+1 and x+2 would be prepared in the fault handling for
> page x+1 then the overhead of taking a fault for x+2 is avoided. However
> page x+2 may never be used and thus we may have increased the rss
> of an application unnecessarily. The swapper will take care of removing
> that page if memory should get tight.

I would be very careful with this. Windows does something like this
by default and one application that I know needs twice as much swap+memory
on Windows than on Linux because of this. Since it uses a lot of memory
it would be a bad regression.

When you add it there should be at least some easy way for an application
to turn it off (madvise and probably sysctl?) and make the heuristic very
conservative.

-Andi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/