Re: [PATCH 7/9 V3] workqueue: explicit way to wait for idlesworkers to finish

From: Tejun Heo
Date: Wed Aug 29 2012 - 14:34:56 EST


Hello,

On Thu, Aug 30, 2012 at 12:51:58AM +0800, Lai Jiangshan wrote:
> busy_worker_rebind_fn() can't return until all idle workers are rebound.
> This order is ensured by rebind_workers() currently.
>
> We use mutex_lock(&worker->pool->manager_mutex) to wait for all idle workers
> to be rebound. this is an explicit way and it will ease the pain of
> the rebind_workers().
>
> The sleeping mutex_lock(&worker->pool->manager_mutex) must be put in the top of
> busy_worker_rebind_fn(), because this busy worker thread can sleep
> before the WORKER_REBIND is cleared, but can't sleep after
> the WORKER_REBIND cleared.

I really can't say I like this overloading of manager_mutex. CPU
up/down are actually behaving like the manager while it's holding the
manager_mutex at least. I don't really think this
non-manager-role-manager-mutex usage is worthwhile whatever
simplification it makes to rebind path. Rebind path being a bit ugly
/ complex is better than it muddling non-cpu-hotplug path further.

Thanks.

--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/