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 20:27:23
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.
>
Below is an ugly 30-second kludge I used yesterday to make progress on
another issue, for which this retardd mlock() limit was a roadblock.
Setting raw pageframe counts with no bounds-check is clearly too
fragile for normal use (let alone commit). One should instead
allocate a new parameter number in uvm_param.h, add a switch-entry for
that new parameter to update_vm_updateminmax() and route any
userland-initiated sysctl changes via sysctl_vm_updateminmax() for
vetting.
Left as an exercise for the reader...
Index: uvm_meter.c
===================================================================
RCS file: /cvsroot/src/sys/uvm/uvm_meter.c,v
retrieving revision 1.33
diff -w -u -r1.33 uvm_meter.c
--- uvm_meter.c 10 Oct 2004 09:57:31 -0000 1.33
+++ uvm_meter.c
@@ -411,6 +411,23 @@
SYSCTL_DESCR("Whether try to zero pages in idle loop"),
NULL, 0, &vm_page_zero_enable, 0,
CTL_VM, CTL_CREATE, CTL_EOL);
+
+ /*XXX make wiredmax a percentage via sysctl_vm_updateminmax? */
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT|CTLFLAG_READONLY,
+ CTLTYPE_INT, "npages",
+ SYSCTL_DESCR(" count of physical "
+ "pages managed via uvm"),
+ NULL, 0, &uvmexp.npages, 0,
+ CTL_VM, CTL_CREATE, CTL_EOL);
+
+ sysctl_createv(clog, 0, NULL, NULL,
+ CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
+ CTLTYPE_INT, "wiredmax",
+ SYSCTL_DESCR("maximum count of physical "
+ "pages lockable via mlock() and friends"),
+ NULL, 0, &uvmexp.wiredmax, 0,
+ CTL_VM, CTL_CREATE, CTL_EOL);
}
/*