Messages in this thread | | | Date | Wed, 20 Mar 2013 11:16:15 -0700 | From | Tejun Heo <> | Subject | Re: [PATCH 17/21] workqueue: simplify workqueue_cpu_up_callback(CPU_ONLINE) |
| |
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
| |