All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Tejun Heo <tj@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: workqueue_set_max_active(wq, 0)?
Date: Thu, 15 Dec 2011 20:26:01 +0100	[thread overview]
Message-ID: <1323977161.1082.12.camel@jlt3.sipsolutions.net> (raw)
In-Reply-To: <20111215191212.GD32002@google.com> (sfid-20111215_201251_422219_444A9248)

On Thu, 2011-12-15 at 11:12 -0800, Tejun Heo wrote:

> > Hm, good point. We can't abstract out all of it -- the freezer API
> > doesn't want to wait for it to finish -- but probably a bit of it.
> > 
> > How do you iterate workqueues? We'd have to do that for the freezer
> > part, unless we want to work on CWQs again.
> 
> By Locking workqueue_lock and walking workqueues list.  Hmmm...

Ah. So fundamentally, the freeze code does:

 * set each gcwq frozen
 * set max_active=0 for each CWQ in each WQ

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?

> > Actually I'm not really sure I understand the differences between WQ,
> > CWQ and GCWQ...
> 
[snip explanation]

thanks.

> The reason why FREEZING currently is on GCWQ is because freezing is a
> system wide operation.  If we're gonna implement pause, I think it
> should probably be in cwq.

Ok, makes sense too.

I think I'm going to do something simpler first though, the locking
scares me a bit. I'll do something for my single-threaded max-active=1
workqueue first directly in mac80211 to try out the idea ...

johannes


  reply	other threads:[~2011-12-15 19:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-09  9:54 workqueue_set_max_active(wq, 0)? 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 [this message]
2011-12-15 19:31             ` 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=1323977161.1082.12.camel@jlt3.sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --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.