tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: netbsd-6: pagedaemon freeze when low on memory



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2013-03-04 20:43, Richard Hansen wrote:
> Hi all,
> 
> 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):
> 
> 1. line 254: uvm_km_va_starved_p() returns true 2. line 258: the
> !kmem_va_starved condition prevents the pagedaemon from sleeping 3.
> lines 330--346: no memory is freed -- it's all still in use 4. go
> to step #1
> 
> To reproduce the freeze:
> 
> 1. acquire an i386 system with 4GB of memory and lots of files in
> the filesystem 2. set the kern.maxvnodes sysctl as high as it will
> go 3. run 'du -skx /' 4. wait for the kernel to run low on memory
> (vnode allocations)
> 
> I believe the bug was introduced in this commit: 
> http://mail-index.netbsd.org/source-changes/2012/02/01/msg031411.html
>
> 
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/uvm/uvm_pdaemon.c#rev1.105
> 
> Attached is an initial attempt at fixing this.  The patch allows
> the pagedaemon to sleep if no memory was reclaimed the last time
> through the loop.  This is probably not a correct or complete fix;
> I don't yet have a comfortable understanding of the inner workings
> of the kernel.
> 
> With the patch applied, the pagedaemon no longer freezes.  However,
> LWPs start piling up in vmem_alloc() waiting for memory to become
> available. So it seems like this change is necessary but not
> sufficient.
> 
> Thoughts?
> 
> Thanks, Richard
> 

Hi,

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.

kind regards,
Lars


- -- 
- ------------------------------------

Mystische Erklärungen:
Die mystischen Erklärungen gelten für tief;
die Wahrheit ist, dass sie noch nicht einmal oberflächlich sind.

   -- Friedrich Nietzsche
   [ Die Fröhliche Wissenschaft Buch 3, 126 ]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlE1DcUACgkQcxuYqjT7GRbwSwCfS9W0tHNBDi5cvLCP/PkFw8Cn
CJMAnjoMPlCYVaymN+vZtpmmm8oWLsGv
=kPfh
-----END PGP SIGNATURE-----


Home | Main Index | Thread Index | Old Index