lkml.org 
[lkml]   [2023]   [May]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [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

    \
     
     \ /
      Last update: 2023-05-23 23:38    [W:2.495 / U:0.072 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site