]> git.karo-electronics.de Git - mv-sheeva.git/commit
workqueue: allow chained queueing during destruction
authorTejun Heo <tj@kernel.org>
Mon, 20 Dec 2010 18:32:04 +0000 (19:32 +0100)
committerTejun Heo <tj@kernel.org>
Mon, 20 Dec 2010 18:32:04 +0000 (19:32 +0100)
commitc8efcc2589464ac70255bb83e10cad61c7c6d295
treea7f9c975831344ba78d3a2f9d252749d0479ca2b
parented41390fa57a21d06e6e3a3c4bc238bab8957fbb
workqueue: allow chained queueing during destruction

Currently, destroy_workqueue() makes the workqueue deny all new
queueing by setting WQ_DYING and flushes the workqueue once before
proceeding with destruction; however, there are cases where work items
queue more related work items.  Currently, such users need to
explicitly flush the workqueue multiple times depending on the
possible depth of such chained queueing.

This patch updates the queueing path such that a work item can queue
further work items on the same workqueue even when WQ_DYING is set.
The flush on destruction is automatically retried until the workqueue
is empty.  This guarantees that the workqueue is empty on destruction
while allowing chained queueing.

The flush retry logic whines if it takes too many retries to drain the
workqueue.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
kernel/workqueue.c