Subject: pkg/36594: Hard system limit makes sysutils/memtester impractical
To: None <,,>
From: Hauke Fath <>
List: pkgsrc-bugs
Date: 07/02/2007 15:05:13
>Number:         36594
>Category:       pkg
>Synopsis:       Hard system limit makes sysutils/memtester impractical
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 02 15:05:13 +0000 2007
>Originator:     Hauke Fath <>
>Release:        NetBSD 4.0_BETA2
/~\  The ASCII Ribbon Campaign                    Hauke Fath
\ /    No HTML/RTF in email	        Institut für Nachrichtentechnik
 X     No Word docs in email	                  TU Darmstadt
/ \  Respect for open standards              Ruf +49-6151-16-3281
System: NetBSD 4.0_BETA2 NetBSD 4.0_BETA2 (SPG_PIII) #0: Fri Jun 8 14:37:43 CEST 2007 hf@Hochstuhl:/var/obj/netbsd-builds/4/i386/sys/arch/i386/compile/SPG_PIII i386
Architecture: i386
Machine: i386

sysutils/memtester is the only non-i386 memory test tool we have in
pkgsrc. Unfortunately, when you run it you will find that no matter
what shell limits you lift, it will not be able to lock more than one
third of the memory:

[hf@Gstoder] /home/hf # limit memorylocked
memorylocked 340774 kbytes
[hf@Gstoder] /home/hf # unlimit memorylocked
[hf@Gstoder] /home/hf # limit memorylocked
memorylocked unlimited
[hf@Gstoder] /home/hf # memtester 400
memtester version 4.0.7 (32-bit)
Copyright (C) 2006 Charles Cazabon.
Licensed under the GNU General Public License version 2 (only).

pagesize is 4096
pagesizemask is 0xfffffffffffff000
want 400MB (419430400 bytes)
got  400MB (419430400 bytes), trying mlock ...failed for unknown reason.
Continuing with unlocked memory; testing will be slower and less reliable.
Loop 1:
  Stuck Address       : setting   3^C
[hf@Gstoder] /home/hf #

Aunt Google comes up with this thread:

| > I think there's a system-wide limit that applies, also.  
| > Not sure how you change it.
|        uvm_pdaemon.c:  uvmexp.wiredmax = uvmexp.npages / 3;
| It doesn't look like it's dynamically adjustable, but it 
| wouldn't be too hard to add to go with the other 
| vm.*max sysctls. (uvm_meter.c)

-- but apparently

[hf@Gstoder] ~ > sysctl -A | grep "vm.*max"
vm.maxslp = 20
vm.anonmax = 90
vm.filemax = 10
vm.execmax = 8
[hf@Gstoder] ~ > uname -prs
NetBSD 4.0_BETA2 i386
[hf@Gstoder] ~ > 

a "wiredmax" field has not been added since.


	Build and install sysutils/memtester. Run it, and note that it
	comes up with a "failed mlock" error if you attempt to cover
	more than a third of the installed memory.


	While it is the OSes responsibility to provide the knob to up
	the max. wired pages limit, the package DESCR should hint at
	the problem, and a possible fix.

	Feel free to change the category to "kern" _after_ the comment
	has been added - most of the related Google hits are for
	Linux OSes, actually.