All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Lai Jiangshan <jiangshanlai@gmail.com>
Cc: Boqun Feng <boqun.feng@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Josef Bacik <josef@toxicpanda.com>,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH workqueue/for-4.14-fixes] workqueue: replace pool->manager_arb mutex with a flag
Date: Mon, 9 Oct 2017 08:08:08 -0700	[thread overview]
Message-ID: <20171009150808.GD3301751@devbig577.frc2.facebook.com> (raw)
In-Reply-To: <CAJhGHyAQuArNBTWcAr5Dq_Lj58yMYUs_01ObNGTJrCt=3Ni3rg@mail.gmail.com>

Hello,

On Mon, Oct 09, 2017 at 11:02:34PM +0800, Lai Jiangshan wrote:
> I was also thinking alternative code when reviewing.
> The first is quite obvious. Testing POOL_MANAGER_ACTIVE
> can be replaced by testing pool->manager.
> And POOL_MANAGER_ACTIVE  is not needed. Isn't it?

put_unbound_pool() doesn't have to be called from a kworker context
and we don't really have a kworker pointer to set pool->manager to.
We can use a bogus value and then update pool->manager dereferences
accordingly but I think it's cleaner to simply use a separate flag.

> The second thing is to make manage_workers()
> and put_unbound_pool() exclusive.
> Waiting event on POOL_MANAGER_ACTIVE(or pool->manager)
> is one way. However, the pool's refcnt is not possible to
> be dropped to zero now since the caller still hold the pool->lock

wait_event_lock_irq() drops the lock if the condition is not met
before going to sleep (otherwise it wouldn't be able to sleep).

> and some pwds of the works in the worklist. So the other way
> to enforce the exclusive could be just doing
> get_pwq(the first pwd of the worklist) and put_pwq() when
> the manage_workers() done. And the code about
> pool->manager_arb in put_unbound_pool() can be
> simply removed.

Yeah, that part is removed.

Thanks!

-- 
tejun

  reply	other threads:[~2017-10-09 15:08 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-08  9:02 [RFC] workqueue: Fix irq inversion deadlock in manage_workers() Boqun Feng
2017-10-08 19:03 ` Tejun Heo
2017-10-09  3:24   ` Boqun Feng
2017-10-09  6:42   ` Peter Zijlstra
2017-10-09 13:07     ` Tejun Heo
2017-10-09  9:40 ` Lai Jiangshan
2017-10-09 12:40   ` Boqun Feng
2017-10-09 15:24   ` Peter Zijlstra
2017-10-09 15:29     ` Tejun Heo
2017-10-09 13:21 ` [PATCH workqueue/for-4.14-fixes] workqueue: replace pool->manager_arb mutex with a flag Tejun Heo
2017-10-09 14:21   ` Boqun Feng
2017-10-09 14:47     ` Tejun Heo
2017-10-09 15:02   ` Lai Jiangshan
2017-10-09 15:08     ` Tejun Heo [this message]
2017-10-09 15:14       ` Lai Jiangshan
2017-10-09 15:33         ` Tejun Heo
2017-10-09 15:04   ` [PATCH v2 " Tejun Heo
2017-10-10  9:55     ` Lai Jiangshan
2017-10-10 14:15     ` Tejun Heo

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=20171009150808.GD3301751@devbig577.frc2.facebook.com \
    --to=tj@kernel.org \
    --cc=boqun.feng@gmail.com \
    --cc=jiangshanlai@gmail.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.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.