]> granicus.if.org Git - zfs/commit
Fix taskq code to not drop tasks when TQ_SLEEP is used.
authorRicardo M. Correia <ricardo.correia@oracle.com>
Mon, 2 Aug 2010 09:24:01 +0000 (09:24 +0000)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 2 Aug 2010 18:20:31 +0000 (11:20 -0700)
commit26f7245c7cfa77f25aedf1a500db689343644ead
tree5359f350cd21d7869bc4ee4b22413a46108d4089
parent41f84a8d56c00f3c95a4bf0b6027bedd7abb5b15
Fix taskq code to not drop tasks when TQ_SLEEP is used.

When TQ_SLEEP is used, taskq_dispatch() should always succeed even if the
number of pending tasks is above tq->tq_maxalloc. This semantic is similar
to KM_SLEEP in kmem allocations, which also always succeed.

However, we cannot block forever otherwise there is a risk of deadlock.
Therefore, we still allow the number of pending tasks to go above
tq->tq_maxalloc with TQ_SLEEP, but we may sleep up to 1 second per task
dispatch, thereby throttling the task dispatch rate.

One of the existing splat tests was also augmented to test for this scenario.
The test would fail with the previous implementation but now it succeeds.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
module/spl/spl-taskq.c
module/splat/splat-taskq.c