[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAJhGHyDso12OTjKTiX7fOnMXHG9-=0jD1p09-1ZgjLeSg18zmA@mail.gmail.com>
Date: Wed, 3 Jun 2020 07:13:32 +0800
From: Lai Jiangshan <jiangshanlai@...il.com>
To: Tejun Heo <tj@...nel.org>
Cc: Lai Jiangshan <laijs@...ux.alibaba.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] workqueue: ensure all flush_work() completed when being destoryed
On Wed, Jun 3, 2020 at 12:13 AM Tejun Heo <tj@...nel.org> wrote:
>
> Hello, Lai.
>
> On Tue, Jun 02, 2020 at 01:49:14PM +0000, Lai Jiangshan wrote:
> > +static void dec_nr_in_flight_flush_work(struct workqueue_struct *wq)
> > +{
> > + if (atomic_dec_and_test(&wq->nr_flush_work))
>
> Do you think it'd make sense to put this in pwq so that it can be
> synchronized with the pool lock instead of using a separate atomic counter?
>
Hello, Tejun
When the counter is put in pwq, there will be a per-pwq counter,
a per-pwq completion or pointer and a flush_workqueue_prep_pwqs()-like
function (although simpler) to set up them before waiting for them.
It would sound like the V1 patch. per-pwq counter may have better
performance over per-wq atomic, it seems too tiny to add code
complicity. V1 has the simplest pwq_dec_nr_in_flight() except
there is too much WARN_ON_ONCE() in flush_no_color().
Thanks
Lai
> Makes sense to me otherwise.
>
> Thanks.
>
> --
> tejun
Powered by blists - more mailing lists