Re: [PATCH] [Request for inclusion] Filesystem in Userspace

Rik van Riel
2004-11-27T17:08:56Z

On Fri, 19 Nov 2004, Miklos Szeredi wrote:

> The solution I'm thinking is along the lines of accounting the number
> of writable pages assigned to FUSE filesystems. Limiting this should
> solve the deadlock problem. This would only impact performance for
> shared writable mappings, which are rare anyway.

Note that NFS, and any filesystems on iSCSI or g/e/ndb block
devices have the exact same problem. To explain why this is
the case, lets start with the VM allocation and pageout
thresholds:

pages_min ------------------

GFP_ATOMIC ------------------

PF_MEMALLOC ------------------

0 ------------------

When writing out a dirty page, the pageout code is allowed
to allocate network buffers down to the PF_MEMALLOC boundary.

However, when receiving the ACK network packets from the server,
the network stack is only allowed to allocate memory down to the
GFP_ATOMIC watermark.

This means it is relatively easy to get the system to deadlock,
under a heavy shared mmap workload. Limiting the number of
simultaneous writeouts might make the problem harder to trigger,
but is still no solution since the network layer could exhaust
its allowed memory for other packets, and never get around to
processing the ACKs for the pageout related network traffic!

I have a solution in mind, but it's not pretty. It might be safe
now that DaveM no longer travels. Still have to come up with a
way to avoid being maimed by the other network developers, though...

--
"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it." - Brian W. Kernighan