Re: [PATCH 6/7] workqueue: Allow cancel_work_sync() and disable_work() from atomic contexts on BH work items

From: Tejun Heo
Date: Thu Feb 22 2024 - 03:32:55 EST


Hello,

On Thu, Feb 22, 2024 at 12:36:29PM +0800, Lai Jiangshan wrote:
> On Thu, Feb 22, 2024 at 1:43 AM Tejun Heo <tj@xxxxxxxxxx> wrote:
>
> > @@ -4077,11 +4076,37 @@ static bool __flush_work(struct work_struct *work, bool from_cancel)
> >
> > rcu_read_lock();
> > pool = start_flush_work(work, &barr, from_cancel);
> > + is_bh = pool && (pool->flags & POOL_BH);
> > rcu_read_unlock();
> > if (!pool)
> > return false;
> >
> > - wait_for_completion(&barr.done);
> > + if (is_bh && from_cancel) {
>
> Can "*work_data_bits(work) & WORK_OFFQ_BH" be used here?
> If so, the previous patch will not be needed.

Hmm... yeah, if we test from_cancel first, we should know that the work item
is offq and then can depend on OFFQ_BH. Maybe I'm missing something. Will
try that.

Thanks.

--
tejun