tech-kern archive

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

Re: netbsd-5 deadlocks when memory is low

David Holland <> wrote:

> The right fix is to not let the kernel wait for userspace. In this
> case that's probably not trivial.

A common case of deadlocks is ioflush waiting for the filesystem and the
filesystem waiting for memory.

As I understand, pagedaemon is responsible for scheduling memory
pageouts, and for vnodes, that will involves ioflush. Is that right? I
have not understood yet where such a relation occurs in the code.

If the above is correct, then we have this situation:
- we get low on memory
- pagedaemon schedule pageouts
- some pageouts involves ioflush
- ioflush sends VOP_FSYNC to user filesystem and wait completion
- user filesystems requests memory and sleeps
- pagedaemon considers that there are enough pages about to be paged out
(uvmexp.paging) to free required memory and will not schedule more
- user filesystem will never get memory, ioflush will never completes,
paging will never be done.

If I am correct, then a possible fix could be to have one ioflush thread
per filesystem. This woule ensure that a user filesystem awaiting memory
would not prevent ioflush work on local filesystem.

Comments? There are a lot of ifs :-)

Emmanuel Dreyfus

Home | Main Index | Thread Index | Old Index