]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Un-staticize runningbufwakeup() and staticize updateproc.
authorDon Lewis <truckman@FreeBSD.org>
Fri, 30 Sep 2005 01:30:01 +0000 (01:30 +0000)
committerDon Lewis <truckman@FreeBSD.org>
Fri, 30 Sep 2005 01:30:01 +0000 (01:30 +0000)
commit6c8b634f1dee3b40dd0ff67ca4f9bfec86c2e759
tree1f814a73e0737d738ff28d17be42b438cdc748d5
parent9e241c5ef20e3dd6605eb6be353ceb99f3144f22
Un-staticize runningbufwakeup() and staticize updateproc.

Add a new private thread flag to indicate that the thread should
not sleep if runningbufspace is too large.

Set this flag on the bufdaemon and syncer threads so that they skip
the waitrunningbufspace() call in bufwrite() rather than than
checking the proc pointer vs. the known proc pointers for these two
threads.  A way of preventing these threads from being starved for
I/O but still placing limits on their outstanding I/O would be
desirable.

Set this flag in ffs_copyonwrite() to prevent bufwrite() calls from
blocking on the runningbufspace check while holding snaplk.  This
prevents snaplk from being held for an arbitrarily long period of
time if runningbufspace is high and greatly reduces the contention
for snaplk.  The disadvantage is that ffs_copyonwrite() can start
a large amount of I/O if there are a large number of snapshots,
which could cause a deadlock in other parts of the code.

Call runningbufwakeup() in ffs_copyonwrite() to decrement runningbufspace
before attempting to grab snaplk so that I/O requests waiting on
snaplk are not counted in runningbufspace as being in-progress.
Increment runningbufspace again before actually launching the
original I/O request.

Prior to the above two changes, the system could deadlock if enough
I/O requests were blocked by snaplk to prevent runningbufspace from
falling below lorunningspace and one of the bawrite() calls in
ffs_copyonwrite() blocked in waitrunningbufspace() while holding
snaplk.

See <http://www.holm.cc/stress/log/cons143.html>
sys/kern/vfs_bio.c
sys/kern/vfs_subr.c
sys/sys/buf.h
sys/sys/proc.h
sys/ufs/ffs/ffs_snapshot.c