Subject: Re: kern/7511: madvise(2) is not implemented
To: None <mrg@eterna.com.au>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: tech-kern
Date: 05/02/1999 18:39:21
On Mon, 3 May 1999 11:00:43 +1000 (EST) 
 mrg@eterna.com.au wrote:

 > write an application that uses MADV_SEQUENTIAL, expecting the VM system
 > to deactivate pages after you have looked at them and notice that this
 > does not appear to happen.  scratch head and read the source (mmm, source)
 > and realise that while the code does advice you can't change it.

MADV_SEQUENTIAL doesn't do this.  SEQUENTIAL is intended to cause a clustered
pagein of page N -> N + M (whatever a convenient cluster size is), so that
faults aren't taken on the subsequent pages.

 > 
 > >Fix:
 > 	
 > write sys_madvise() function to do the following:
 > 
 > 	(a) for MADV_{NORMAL,RANDOM,SEQUENTIAL} update the advice of the
 > 	    affected maps so that future faults have the expected behaviour.
 > 	(b) for MADV_WILLNEED -- what to do here?  i'm not sure of the best
 > 	    way to handle this request.

WILLNEED causes those pages to be pre-faulted, before they're accessed.

 > 	(c) for MADV_DONTNEED deactivate the pages immediately (but do not
 > 	    free them).
 > 	(d) MADV_SAPCEAVAIL -- what to do here also?
 > 
 > 
 > i plan on addressing this myself at sometime in the near future, but
 > wanted to get it logged into the PR database, and also request comments
 > on (b) and (d) above from others.
 > >Audit-Trail:
 > >Unformatted:

        -- Jason R. Thorpe <thorpej@nas.nasa.gov>