Re: [PATCH] kthread_work: add cancel_kthread_work[_sync]()

From: Tejun Heo
Date: Mon Jul 28 2014 - 14:20:47 EST


On Sat, Jul 26, 2014 at 12:04:01PM +0800, Lai Jiangshan wrote:
> When an object or a subsystem quits, we need to destroy the kthread_work
> which is used by the object or the subsystem. We used to use
> flush_kthread_work(). But flush_kthread_work() has not any guarantee
> about the suspension of the work, this duty is pushed to the users.
>
> So we introduce the cancel_kthread_work_sync() with a strict guarantee
> like cancel_work_sync() (workqueue). We also introduce cancel_kthread_work()
> which can be used by users on some conditions. And it is required for
> making the implementation of the cancel_kthread_work_sync() simpler.
> kthread_flush_work_fn() owns the running state of the kthread_worker
> and calls cancel_kthread_work() to cancel the possible requeued work.
>
> Both cancel_kthread_work_sync() and cancel_kthread_work() share the
> code of flush_kthread_work() which also make the implementation simpler.
>
> Signed-off-by: Lai Jiangshan <laijs@xxxxxxxxxxxxxx>
> ---
> include/linux/kthread.h | 2 +
> kernel/kthread.c | 78 ++++++++++++++++++++++++++++++++++++++--------
> 2 files changed, 66 insertions(+), 14 deletions(-)

We don't have any user. Let's not implement features which aren't
used just for completeness. If you can spot and convert users, please
be my guest.

Thanks.

--
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/