Re: missing madvise functionality

Hugh Dickins
2007-04-04T14:37:24Z

On Wed, 4 Apr 2007, Marko Macek wrote:
> Ulrich Drepper wrote:
> > A solution for this problem is a madvise() operation with the following
> > property:
> >
> > - the content of the address range can be discarded
> >
> > - if an access to a page in the range happens in the future it must
> > succeed. The old page content can be provided or a new, empty page
> > can be provided
>
> Doesn't this conflict with disabling overcommit?
>
> If the page is guaranteed to be available, obviously it must count as
> being commited, so this is not equivalent to real freeing.

No, there's no conflict with disabled overcommit here: Committed_AS
accounting is done on the whole vma size (at mmap or brk time), no
matter how many pages may or may not be faulted in later. Rather
like RLIMIT_AS. The proposed madvise operation won't affect it.

(But I take Ulrich's "must succeed" with one pinch of salt:
Out-Of-Memory killing remains a possibility, of course.)

Hugh