Re: [PATCH 13/17] workqueue: Remove WORK_OFFQ_CANCELING
From: Tejun Heo
Date: Tue Feb 20 2024 - 13:53:38 EST
On Tue, Feb 20, 2024 at 03:23:53PM +0800, Lai Jiangshan wrote:
> Hello, Tejun
>
> On Sat, Feb 17, 2024 at 2:06 AM Tejun Heo <tj@xxxxxxxxxx> wrote:
>
> > @@ -2631,19 +2567,13 @@ bool mod_delayed_work_on(int cpu, struct workqueue_struct *wq,
> > struct delayed_work *dwork, unsigned long delay)
> > {
> > unsigned long irq_flags;
> > - int ret;
> > + bool ret;
> >
> > - do {
> > - ret = try_to_grab_pending(&dwork->work, WORK_CANCEL_DELAYED,
> > - &irq_flags);
> > - } while (unlikely(ret == -EAGAIN));
> > + ret = work_grab_pending(&dwork->work, WORK_CANCEL_DELAYED, &irq_flags);
> >
> > - if (likely(ret >= 0)) {
> > - __queue_delayed_work(cpu, wq, dwork, delay);
> > - local_irq_restore(irq_flags);
> > - }
> > + __queue_delayed_work(cpu, wq, dwork, delay);
>
> The disable count has to be checked before queuing it.
Ah, right, this also needs a clear_pending_if_disabled() call.
Thanks.
--
tejun