[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20111215193133.GF32002@google.com>
Date: Thu, 15 Dec 2011 11:31:33 -0800
From: Tejun Heo <tj@...nel.org>
To: Johannes Berg <johannes@...solutions.net>
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: Re: workqueue_set_max_active(wq, 0)?
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
--
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