kib 031d824a49 When helping the bufdaemon from the buffer allocation context, there
is no sense to walk the whole dirty buffer queue.  We are only
interested in, and can operate on, the buffers owned by the current
vnode [1].  Instead of calling generic queue flush routine, do
VOP_FSYNC() if possible.

Holding the dirty buffer queue lock in the bufdaemon, without dropping
it, can cause starvation of buffer writes from other threads. This is
esp. easy to reproduce on the big memory machines, where large files
are written, causing almost all dirty buffers accumulating in several
big files, which vnodes are locked by writers. Bufdaemon cannot flush
any buffer, but is iterating over the whole dirty queue
continuously. Since dirty queue mutex is not dropped, bufdone() in
g_up thread is starved, usually deadlocking the machine [2]. Mitigate
this by dropping the queue lock after the vnode is locked, allowing
other queue lock contenders to make a progress.

Discussed with:	Jeff [1]
Reported by:	pho [2]
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Approved by:	re (hrs)
2013-10-02 06:00:34 +00:00
..
2013-09-07 19:16:02 +00:00
2013-09-19 18:56:00 +00:00
MFC
2011-05-31 21:22:44 +00:00
2013-09-05 18:18:23 +00:00
2013-02-02 14:19:50 +00:00
2012-08-22 20:01:57 +00:00
2012-03-28 20:58:30 +00:00
2013-08-07 07:22:56 +00:00
2012-11-14 10:33:12 +00:00
2012-06-25 05:41:16 +00:00
2012-09-04 23:16:55 +00:00
2012-01-26 16:35:09 +00:00
2013-08-24 14:41:49 +00:00
2013-09-19 18:56:00 +00:00
2012-01-02 12:12:10 +00:00
2012-10-25 09:05:21 +00:00
2013-09-05 10:24:09 +00:00
MFC
2013-02-21 21:59:35 +00:00
2013-06-29 05:05:57 +00:00