Re: missing madvise functionality

Andi Kleen
2007-04-03T22:52:00Z

On Tue, Apr 03, 2007 at 02:46:09PM -0700, Ulrich Drepper wrote:
> Eric Dumazet wrote:
> > A page fault is not that expensive. But clearing N*PAGE_SIZE bytes is,
> > because it potentially evicts a large part of CPU cache.
>
> *A* page fault is not that expensive. The problem is that you get a
> page fault for every single page. For 200k allocated you get 50 page
> faults. It quickly adds up.

If you know in advance you need them it might be possible to
batch that. e.g. MADV_WILLNEED could be extended to
work on anonymous memory and establish the mappings in the syscall.
Would that be useful?

-Andi