[PATCHSET] kthread_worker: reimplement flush_kthread_work() toallow freeing during execution

From: Tejun Heo
Date: Thu Jul 19 2012 - 17:15:12 EST


Hello,

kthread_worker was introduced together with concurrency managed
workqueue to serve workqueue users which need a special dedicated
worker - e.g. RT scheduling. This is minimal queue / flush / flush
all iterface on top of kthread and each provided interface matches the
workqueue counterpart so that switching isn't difficult.

However, one noticeable difference was that kthread_worker doesn't
allow a work item to be freed while being executed. The intention was
to keep the code simpler but it didn't really and the restriction is
subtle and does prevent some valid use cases.

This two-patch series reimplements flush_kthread_work() so that it
uses an extra work item for flushing. While this takes a bit more
lines, this is easier to understand and removes the annoying
difference.

This patchset contains the following two patches.

0001-kthread_worker-reorganize-to-prepare-for-flush_kthre.patch
0002-kthread_worker-reimplement-flush_kthread_work-to-all.patch

The first one is a prep patch which makes no functional changes. The
second reimplements flush_kthread_work().

All current kthread_worker users are cc'd. If no one objects, I'll
push it through the workqueue branch. This patchset is also available
in the following git branch.

git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq.git review-kthread_worker-flush

diffstat follows. Thanks.

include/linux/kthread.h | 8 +---
kernel/kthread.c | 86 +++++++++++++++++++++++++++---------------------
2 files changed, 52 insertions(+), 42 deletions(-)

--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/