Subject: 3.1 thrashing excessively?
To: None <tech-kern@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 05/28/2007 11:59:43
I've got a compilation running on a 3.1 hpcmips machine.  It seems to
be thrashing (this based on both feel - how quickly things get paged
out when they're idle - and vmstat output).

Trouble is, I can't see why.  According to /kern/pagesize and
/kern/physmem, the machine has 48M.  And if I run "ps -a -x -O vsz,rss"
and add up the RSS column figures (skipping all but one of the kernel
threads), I get 27184, only barely over half the RAM.

top says

Memory: 14M Act, 7260K Inact, 4476K Wired, 6568K Exec, 10M File, 1060K Free

Adding those up gives me a little under 43M, almost as much as the
"avail memory" figure printed on boot.  It looks to me as though the
major offender is "File"; I would expect it to cache less file data and
give cc1plus enough RAM to run comfortably.

I assume the missing 21+M of RAM according to ps represents
file+inact+wired or some such.  But I'd like to know how to get saner
RAM allocation.  "sysctl vm" reports

vm.loadavg: 1.65 1.69 1.67
vm.nkmempages = 12288
vm.anonmin = 10
vm.execmin = 5
vm.filemin = 10
vm.maxslp = 20
vm.uspace = 8192
vm.anonmax = 80
vm.execmax = 30
vm.filemax = 50
vm.bufcache = 15
vm.bufmem = 929792
vm.bufmem_lowater = 936960
vm.bufmem_hiwater = 7495680
vm.idlezero = 0

which looks to me as though it should be willing to ratchet the file
cache down to 10% of RAM, but as I read top's output, that's not
happening.  (This same compiler run has been crawling for something
like three hours, presumably because only about 10% of the CPU is
actually doing work, as opposed to waiting for pageins and pageouts.)

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B