Swapfile problem in 6?

Don Lewis truckman at FreeBSD.org
Mon Jan 2 03:14:51 PST 2006


Attempting to catch up with my backlog of unread email, only 12K unread
messages to go ...

On 24 Nov, Rob wrote:

> I have cvsup'ed the sources to STABLE as of Nov. 23rd
> 2005.
> After recompiling/installing world and debug-kernel,
> I again get a kernel deadlock when using swapfile:
>    http://surfion.snu.ac.kr/~lahaye/swapfile2.txt
> 
> Previous deadlocks are still documented here
>    http://surfion.snu.ac.kr/~lahaye/swapfile.txt
> 
> I hope this is of use for fixing this bug in 6.
> If further investigation is needed, then please let me
> know.

This is a deadlock caused by memory exhaustion.  The pagedaemon only has
a limited number of bufs that it uses for writing dirty pages to swap to
prevent it from saturating the I/O subsystem with large numbers of
writes.  In this case, pagedaemon is trying to free up memory by writing
dirty pages, and it has used up all of its bufs and is waiting for the
write requests to complete and the bufs the bufs to be returned to it.
This isn't happening because md0 is stuck waiting for memory.  This is a
little bit suprising to me because it looks like writes to vnode backed
devices are done synchronously by default.

If you have a chance to test this again, a stack trace of md0 in the
deadlock state would be interesting.  I'd like to know where md0 is
getting stuck.

I wonder if pagedaemon should scan ahead and more agressively discard
clean pages when it has run out of bufs to write dirty pages, especially
in low memory situations.  Preventing the creation of more dirty pages
would be nice, but I don't know how to do that ...



More information about the freebsd-stable mailing list