lkml.org 
[lkml]   [2011]   [Dec]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 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


\
 
 \ /
  Last update: 2011-12-15 20:33    [W:1.672 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site