From: Tejun Heo <tj@kernel.org>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: workqueue_set_max_active(wq, 0)?
Date: Thu, 15 Dec 2011 11:31:33 -0800 [thread overview]
Message-ID: <20111215193133.GF32002@google.com> (raw)
In-Reply-To: <1323977161.1082.12.camel@jlt3.sipsolutions.net>
Hello,
On Thu, Dec 15, 2011 at 08:26:01PM +0100, Johannes Berg wrote:
> Ah. So fundamentally, the freeze code does:
>
> * set each gcwq frozen
> * set max_active=0 for each CWQ in each WQ
Yeap and then iterate over them waiting for all nr_actives to drop to
zero.
> but it interleaves the two loops. I guess this would have to be
> untangled if we want to share it so it sets all gcwq frozen and then
> iterates the workqueues and their CWQs. Locking seems a bit hairy
> though, why does the current code keep the GCWQ lock over CWQ changes? I
> guess that's so nothing can work on the CWQ?
All CWQ's are protected by the corresponding GCWQ lock, so all CWQs on
the same CPU are protected by single gcwq->lock on that CPU. It's
actually rather simple. The reason the loop there is interleaved is
to avoid releasing and grabbing different gcwq->lock's for each
iteration. I don't think that would really matter either way.
Thanks.
--
tejun
prev parent reply other threads:[~2011-12-15 19:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-09 9:54 Johannes Berg
2011-12-09 16:57 ` Tejun Heo
2011-12-09 16:59 ` Johannes Berg
2011-12-15 15:38 ` Johannes Berg
2011-12-15 18:35 ` Tejun Heo
2011-12-15 18:43 ` Johannes Berg
2011-12-15 19:12 ` Tejun Heo
2011-12-15 19:26 ` Johannes Berg
2011-12-15 19:31 ` Tejun Heo [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=20111215193133.GF32002@google.com \
--to=tj@kernel.org \
--cc=johannes@sipsolutions.net \
--cc=linux-kernel@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome