Subject: Re: lazy mlock?
To: None <>
From: Alfred Perlstein <>
List: tech-kern
Date: 04/16/2002 15:16:57
* Richard Earnshaw <> [020416 15:04] wrote:
> So, how hard would it be to add a syscall that would only lock a page into 
> memory if it were really needed?  That is, we start with an empty set of 
> locked pages, then as a page is referenced it is loaded and locked in 
> place (so that it won't be swapped out again later).  This way, pages that 
> aren't referenced will never be locked, and pages that are will only pay 
> the fetch cost once (on first reference).  For something like ntp this 
> would surely be perfectly adequate.

I think you could achieve the same thing using mprotect(2) and
smarts in your signal handler to then mlock(2) the memory you
fault on.

-Alfred Perlstein []
'Instead of asking why a piece of software is using "1970s technology,"
 start asking why software is ignoring 30 years of accumulated wisdom.'
Tax deductible donations for FreeBSD: