Subject: Re: Can't lock even 4GB on system with 8GB RAM?
To: None <tls@rek.tjls.com>
From: Jonathan Stone <jonathan@Pescadero.dsg.stanford.edu>
List: tech-kern
Date: 01/12/2006 19:57:41
In message <20060113020701.GA5477@panix.com>Thor Lancelot Simon writes
>I have an amd64 system with 8GB of RAM.  I'm trying to run a memory tester,
>and find that even with the datasize, memoryuse, and memorylocked hard and
>soft limits set to unlimited, I can't mlock even 4GB.

Yes, indeed.

>This seems wrong.

Not so much wrong, as incompetent.

See the mlock() manpage; the relevant limit is the smaller of the
per-process RLIMIT_MEMLOCK limit, and a systemwide limit, namely
uvmexp.wiredmax. See src/sys/uvmm/uvm_mmap.c

Some ... gitfinger[*] decided to arbitrarily set uvmexp.wiredmax to
1/3rd of uvm-managed memory, and there's no way to change that via
sysctl.  (there may have been once, but uvmexp changed, and Simon
preserved the sysctl-struct API by copying the new struct to the old,
making it effectively readonly).

[*] in memory of Kenny Everett, and the Kenny Everett Video Show.