Re: [PATCH 12/17] workqueue: Implement disable/enable for (delayed) work items

From: Tejun Heo
Date: Wed Feb 21 2024 - 00:48:09 EST


Hello,

On Wed, Feb 21, 2024 at 10:54:46AM +0800, Lai Jiangshan wrote:
> I think it is better to have the same handling (checking disable count)
> in queue_rcu_work().
>
> 1) code is consistent with other queuing code
> 2) known state: no work item is queued with disable count > 0
> 3) catch wrong usages: some complaining code can be added when adding the check.
>
> Adding checking and complaining in the code is as important as
> adding a comment stating rcu work is not allowed to be disabled/canceled.

Sure, will add a WARN_ON_ONCE().

> > I'm not quite sure flush_delayed_work() is safe. Will think more about that.
>
> I think the code successfully deleting the timer not only owns the pending bit
> but also ensures the disable count is zero.

Yeah, this should be fine.

Thanks.

--
tejun