[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZG0yCiRI8apvfWkq@slm.duckdns.org>
Date: Tue, 23 May 2023 11:37:14 -1000
From: Tejun Heo <tj@...nel.org>
To: Lai Jiangshan <jiangshanlai@...il.com>
Cc: torvalds@...ux-foundation.org, peterz@...radead.org,
linux-kernel@...r.kernel.org, kernel-team@...a.com,
joshdon@...gle.com, brho@...gle.com, briannorris@...omium.org,
nhuck@...gle.com, agk@...hat.com, snitzer@...nel.org,
void@...ifault.com
Subject: Re: [PATCH 03/24] workqueue: Not all work insertion needs to wake up
a worker
On Tue, May 23, 2023 at 05:54:10PM +0800, Lai Jiangshan wrote:
> On Fri, May 19, 2023 at 8:17 AM Tejun Heo <tj@...nel.org> wrote:
>
> > + pool = pwq->pool;
> > +
> > /*
> > * If @work was previously on a different pool, it might still be
> > * running there, in which case the work needs to be queued on that
> > * pool to guarantee non-reentrancy.
> > */
> > last_pool = get_work_pool(work);
> > - if (last_pool && last_pool != pwq->pool) {
> > + if (last_pool && last_pool != pool) {
> > struct worker *worker;
> >
> > raw_spin_lock(&last_pool->lock);
> > @@ -1638,13 +1636,14 @@ static void __queue_work(int cpu, struct workqueue_struct *wq,
> >
> > if (worker && worker->current_pwq->wq == wq) {
> > pwq = worker->current_pwq;
> > + pool = pwq->pool;
>
> The code above does a "raw_spin_lock(&last_pool->lock);", and
> the code next does a "raw_spin_unlock(&pool->lock);".
>
> WARN_ON_ONCE(pool != last_pool);
>
> can be added here and served as a comment.
Yeah, this is a bit confusing. Added WARN_ON_ONCE().
Thanks.
--
tejun
Powered by blists - more mailing lists