Messages in this thread | | | Date | Tue, 23 May 2023 11:37:14 -1000 | From | Tejun Heo <> | 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@kernel.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
| |