From: Tejun Heo Date: Tue, 19 Mar 2013 20:45:21 +0000 (-0700) Subject: workqueue: convert worker_pool->worker_ida to idr and implement for_each_pool_worker() X-Git-Tag: omap-for-v3.10/dt-fixes-for-merge-window~125^2~34 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=822d8405d13931062d653e0c2cc0199ed801b072;p=pandora-kernel.git workqueue: convert worker_pool->worker_ida to idr and implement for_each_pool_worker() Make worker_ida an idr - worker_idr and use it to implement for_each_pool_worker() which will be used to simplify worker rebinding on CPU_ONLINE. pool->worker_idr is protected by both pool->manager_mutex and pool->lock so that it can be iterated while holding either lock. * create_worker() allocates ID without installing worker pointer and installs the pointer later using idr_replace(). This is because worker ID is needed when creating the actual task to name it and the new worker shouldn't be visible to iterations before fully initialized. * In destroy_worker(), ID removal is moved before kthread_stop(). This is again to guarantee that only fully working workers are visible to for_each_pool_worker(). Signed-off-by: Tejun Heo Reviewed-by: Lai Jiangshan --- Reading git-diff-tree failed