On 2013-03-04 16:10, Lars Heidieker wrote: > On 2013-03-04 20:43, Richard Hansen wrote: >> I believe I have found a bug in the pagedaemon (uvm_pageout() in >> src/sys/uvm/uvm_pdaemon.c) that causes the system to freeze when >> the kmem_arena runs low (<10% free): [snip] > > if you increase kern.maxvnodes a lot you need to increase the kmem > allowed in order to accommodate all the vnodes. > Try recompiling a kernel with NKMEMPAGES_MAX option set higher then > the default (360mb on i386) eg 450mb.
Ah, that's good to know, thanks! I'll turn up NKMEMPAGES_MAX. But, isn't this a bug regardless of the values of kern.maxvnodes and NKMEMPAGES_MAX? Shouldn't the pagedaemon not freeze under memory pressure? Some background: Turning up kern.maxvnodes is just a convenient way to demonstrate the freeze on an unmodified NetBSD kernel. I first encountered this freeze in a custom kernel that kmem_alloc()s a lot more memory than an unmodified NetBSD kernel. I'll turn up NKMEMPAGES_MAX in the custom kernel, but it'd still be desirable if the kernel handled out-of-memory conditions more gracefully. If an iteration in the pagedaemon doesn't free anything, perhaps kmem_alloc(size, KM_SLEEP) should return NULL? Or maybe the kernel should panic()? Maybe the pagedaemon should ask other subsystems (e.g., vnode cache) to free some memory? Thanks, Richard
