Subject: Re: Virtual Memory Problems with 1.2
To: Bill Harris <billh@airmail.net>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: port-pmax
Date: 12/15/1996 16:17:36
Bill Harris writes:

>We've got a 5k/240 that we tried to put into production as an Apache
>Web server this morning.  We had been testing it with no problems, but
>when we actually threw the user load, the system paniced after about 60 
>seconds and burped the following message to the console and logs.

>Dec 13 10:18:28 gatekeeper /netbsd: panic: vm_fork: no more kernel virtual
memory

OK, so you're running out of kernel virtual memory.

Grepping in /sys/vm shows the panic message is coming from  vm_fork(),
because kmem_alloc_pageable() has returned zero, indicating there's
no more kernel _virtual_ memory left to satisfy a fork() request.

Looking at kmem_alloc_pageable() shows that the kernel_map -- the
Mach-style VM structure used for the kernel's virtual address space --
doesn't have space to satisfy the request.  (This has nothing to do
with swap space, it's more like the kernel running out of pagetable
space for its own malloc() heap).

Grepping the code again, kernel_map is being allocated by vm_init(),
using the global variables virtual_avail and virtual_end.
Chasing down _those_ shows that they're initialized in the mips pmap
module, based on the size of Sysmap.

In short, you need to increase KMEM_VM_SIZE. (Not surprising, having
done something similar on an i386 where profiling ate 2MBytes of
kernel VM space.)


And the canonical way to do _that_ is to  increase NKMEMCLUSTERS
(in mips/include/mips_param.h).

I'd double it and see if that helps.  Knowing how many users you want
to throw at this machine might help come up with better estimates.