Subject: Re: How to Disable Page Swapping to Disk in NetBSD?
To: None <tech-kern@netbsd.org>
From: Thor Lancelot Simon <tls@rek.tjls.com>
List: tech-kern
Date: 12/19/2004 00:12:04
On Fri, Dec 17, 2004 at 03:12:02PM -0800, Karthik Karupasamy wrote:
> Hello everyone... 
> 
> We are considering to use NetBSD for an embedded
> platform. So, here I am with a dumb question. I would
> greatly appreciate it if somebody can point me towards
> the right direction.
> 
> Here goes:
> 
> How do I disable Page swapping? The intention is to
> reduce the latency in switching between tasks.

Just don't configure any swap space when the system starts up.  If you
really want all application pages -- even executable code, not just
data -- to stay resident in RAM and never be read from secondary storage --
one thing you could do would be to modify the C library (or the main()
function of all executables you provide) to call mlockall(MCL_FUTURE).
For this to work, you will also need to modify the default memorylocked 
limit so that it is as high as the memoryuse limit.

Thor