From: Lai Jiangshan <jiangshanlai@gmail.com>
To: Tejun Heo <tj@kernel.org>
Cc: Lai Jiangshan <laijs@linux.alibaba.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] workqueue: ensure all flush_work() completed when being destoryed
Date: Wed, 3 Jun 2020 07:13:32 +0800 [thread overview]
Message-ID: <CAJhGHyDso12OTjKTiX7fOnMXHG9-=0jD1p09-1ZgjLeSg18zmA@mail.gmail.com> (raw)
In-Reply-To: <20200602161350.GH31548@mtj.thefacebook.com>
On Wed, Jun 3, 2020 at 12:13 AM Tejun Heo <tj@kernel.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
prev parent reply other threads:[~2020-06-02 23:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-01 6:08 [PATCH] workqueue: ensure all flush_work() completed when being destoryed Lai Jiangshan
2020-06-01 15:31 ` Tejun Heo
2020-06-02 13:49 ` Lai Jiangshan
2020-06-02 16:13 ` Tejun Heo
2020-06-02 23:13 ` Lai Jiangshan [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAJhGHyDso12OTjKTiX7fOnMXHG9-=0jD1p09-1ZgjLeSg18zmA@mail.gmail.com' \
--to=jiangshanlai@gmail.com \
--cc=laijs@linux.alibaba.com \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.