[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140416152326.GG1257@htj.dyndns.org>
Date: Wed, 16 Apr 2014 11:23:26 -0400
From: Tejun Heo <tj@...nel.org>
To: Lai Jiangshan <laijs@...fujitsu.com>
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH V2] workqueue: fix possible race condition when rescuer
VS pwq-release
Hello, Lai.
On Wed, Apr 16, 2014 at 09:25:16AM +0800, Lai Jiangshan wrote:
> 1) Our aim is to protect unbound pwq, not percpu pwq which can't be be protected by get_pwq().
> 2) get_pwq() will make reviewers confused/surprised, destroy_workqueue() may destroy percpu pwqs
> with ref > 1. At least we need to add more comments explain this behavior. Origin comments:
> /*
> * The base ref is never dropped on per-cpu pwqs. Directly
> * free the pwqs and wq.
> */
You can just comment "pwqs might go away at any time, pin it until
rescuer is done with it" and that's actually the better way to do it.
percpu wq's not supporting attribute changes may change in the future.
What the code path wants is pinning down the pwq no matter where it
came from. There's no point in distinguishing unbound and per-cpu
here.
> 3) get_unbound_pwq() self document.
Not really. If the name is get_pwq_if_unbound(), maybe. Functions
which take args and become noop depending on the argument aren't
generally good ideas. There are specific cases that they are suitable
but this is just gratuituous.
Thanks.
--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists