Subject: Re: Flag MAP_NORESERVE for mmap() implemented in NetBSD 3.0?
To: None <email@example.com>
From: Christian Biere <firstname.lastname@example.org>
Date: 11/20/2006 11:08:48
Sourath Roy wrote:
> If NetBSD implements memory overcommit policy, then in cases where there is
> no real memory would the behavior be same as Linux? i.e., OOM coming in and
> killing processes randomly?
As nobody answered this, yes, as far as I can tell that's the case. If you
run out of swap or disable it, you likely see processes killed with a
"UVM: [...] killed: out of swap" logged to the console.
> Is there a way to stop this overcommit policy in NetBSD?
Not as far as I know. However, mlock() does not require privileges on NetBSD,
so every user can lock physical memory up to a configured resource limit. So if
you wanted to make sure a certain process is never killed due to running out of
memory, you could modify it to use mmap() + mlock() possibly even by overriding
malloc() et al. with LD_PRELOAD. Otherwise, you have to ensure, you have enough
swap for the worst case and likely offenders should have tight memory resource