[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJhGHyCvk=uqcjjf-=L64ig2m00qdEuRLSvc0qiJm_SftGqunQ@mail.gmail.com>
Date: Wed, 21 Feb 2024 10:54:46 +0800
From: Lai Jiangshan <jiangshanlai@...il.com>
To: Tejun Heo <tj@...nel.org>
Cc: torvalds@...ux-foundation.org, linux-kernel@...r.kernel.org,
allen.lkml@...il.com, kernel-team@...a.com
Subject: Re: [PATCH 12/17] workqueue: Implement disable/enable for (delayed)
work items
On Wed, Feb 21, 2024 at 2:38 AM Tejun Heo <tj@...nel.org> wrote:
>
> Hello,
>
> On Tue, Feb 20, 2024 at 03:22:26PM +0800, Lai Jiangshan wrote:
> > > - A work item carries 10bit disable count in work->data while not queued.
> > > The access to the count is synchronized by the PENDING bit like all other
> > > parts of work->data.
> >
> > It is 16bit disable count in the code.
>
> Fixed.
>
> > It misses the same handling at queue_work_node() and queue_rcu_work().
>
> Oops, fixed queued_work_node() but I don't think the latter is an issue
> given that calling work interface functions in the embedded work is not
> supported and rcu_work can't even be canceled.
Hello, Tejun
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.
>
> 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.
Thanks
Lai
Powered by blists - more mailing lists