[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130310123446.GD24522@htj.dyndns.org>
Date:	Sun, 10 Mar 2013 05:34:46 -0700
From:	Tejun Heo <tj@...nel.org>
To:	Lai Jiangshan <laijs@...fujitsu.com>
Cc:	linux-kernel@...r.kernel.org, axboe@...nel.dk, jmoyer@...hat.com,
	zab@...hat.com
Subject: Re: [PATCH 07/31] workqueue: restructure pool / pool_workqueue
 iterations in freeze/thaw functions
Hello, Lai.
On Sun, Mar 10, 2013 at 06:09:17PM +0800, Lai Jiangshan wrote:
> > +	/* clear FREEZING */
> > +	for_each_pool(pool, id) {
> > +		spin_lock(&pool->lock);
> > +		WARN_ON_ONCE(!(pool->flags & POOL_FREEZING));
> > +		pool->flags &= ~POOL_FREEZING;
> > +		spin_unlock(&pool->lock);
> > +	}
> 
> 
> I think it would be better if we move this code to ...
> 
> >  
> > -			wake_up_worker(pool);
> > +	/* restore max_active and repopulate worklist */
> > +	list_for_each_entry(wq, &workqueues, list) {
> > +		if (!(wq->flags & WQ_FREEZABLE))
> > +			continue;
> >  
> > -			spin_unlock(&pool->lock);
> > +		for_each_pwq(pwq, wq) {
> > +			spin_lock(&pwq->pool->lock);
> > +			pwq_set_max_active(pwq, wq->saved_max_active);
> > +			spin_unlock(&pwq->pool->lock);
> >  		}
> >  	}
> >  
> > +	/* kick workers */
> > +	for_each_pool(pool, id) {
> > +		spin_lock(&pool->lock);
> > +		wake_up_worker(pool);
> > +		spin_unlock(&pool->lock);
> > +	}
> 
> 
> ... to here.
> 
> clear FREEZING and then kick.
Yeah, that would be prettier but also change the order of operations
which I'd like to keep the same across the conversion.  We can create
a separate patch to merge the two loops later.  Care to send a
separate patch?
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
 
