Re: [PATCH 17/21] workqueue: simplifyworkqueue_cpu_up_callback(CPU_ONLINE)

From: Tejun Heo
Date: Wed Mar 20 2013 - 14:16:25 EST


On Wed, Mar 20, 2013 at 03:28:17AM +0800, Lai Jiangshan wrote:
> If we have 4096 CPUs, workqueue_cpu_up_callback() will travel too much CPUs,
> to avoid it, we use for_each_cpu_worker_pool for the cpu pools and
> use unbound_pool_hash for unbound pools.
>
> After it, for_each_pool() becomes unused, so we remove it.
> case CPU_DOWN_FAILED:
> case CPU_ONLINE:
> - mutex_lock(&pools_mutex);
> -
> - for_each_pool(pool, pi) {
> - mutex_lock(&pool->manager_mutex);
> -
> - if (pool->cpu == cpu) {
> - associate_cpu_pool(pool);
> - } else if (pool->cpu < 0) {
> - restore_unbound_workers_cpumask(pool, cpu);
> - }
> -
> - mutex_unlock(&pool->manager_mutex);
> - }
> + for_each_cpu_worker_pool(pool, cpu)
> + associate_cpu_pool(pool);
>
> + mutex_lock(&pools_mutex);
> + hash_for_each(unbound_pool_hash, bkt, pool, hash_node)
> + restore_unbound_workers_cpumask(pool, cpu);
> mutex_unlock(&pools_mutex);
> break;

Hmmm... can you add for_each_unbound_pool() with proper lockdep
assertion? Also, don't shuffle locking and flag setting around. It
doesn't make any functional difference and I kinda like global stuff
in the hotplug callback and actual worker handling in the helper
functions.

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/