summaryrefslogtreecommitdiffstats
path: root/kernel/workqueue.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-03-12 14:30:00 -0400
committerTejun Heo <tj@kernel.org>2013-03-12 14:30:00 -0400
commit4e1a1f9a051b4c9a2821a2a0f7f4a27c701fba51 (patch)
tree637cab0901bc51e12b1453c4f67a5387b8a673d1 /kernel/workqueue.c
parent34a06bd6b6fa92ccd9d3e6866b6cb91264c3cd20 (diff)
workqueue: separate out init_worker_pool() from init_workqueues()
This will be used to implement unbound pools with custom attributes. This patch doesn't introduce any functional changes. Signed-off-by: Tejun Heo <tj@kernel.org> Reviewed-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r--kernel/workqueue.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 16f7f8d79d35..094f16668e1b 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -3123,6 +3123,26 @@ int keventd_up(void)
3123 return system_wq != NULL; 3123 return system_wq != NULL;
3124} 3124}
3125 3125
3126static void init_worker_pool(struct worker_pool *pool)
3127{
3128 spin_lock_init(&pool->lock);
3129 pool->flags |= POOL_DISASSOCIATED;
3130 INIT_LIST_HEAD(&pool->worklist);
3131 INIT_LIST_HEAD(&pool->idle_list);
3132 hash_init(pool->busy_hash);
3133
3134 init_timer_deferrable(&pool->idle_timer);
3135 pool->idle_timer.function = idle_worker_timeout;
3136 pool->idle_timer.data = (unsigned long)pool;
3137
3138 setup_timer(&pool->mayday_timer, pool_mayday_timeout,
3139 (unsigned long)pool);
3140
3141 mutex_init(&pool->manager_arb);
3142 mutex_init(&pool->assoc_mutex);
3143 ida_init(&pool->worker_ida);
3144}
3145
3126static int alloc_and_link_pwqs(struct workqueue_struct *wq) 3146static int alloc_and_link_pwqs(struct workqueue_struct *wq)
3127{ 3147{
3128 bool highpri = wq->flags & WQ_HIGHPRI; 3148 bool highpri = wq->flags & WQ_HIGHPRI;
@@ -3790,23 +3810,8 @@ static int __init init_workqueues(void)
3790 struct worker_pool *pool; 3810 struct worker_pool *pool;
3791 3811
3792 for_each_std_worker_pool(pool, cpu) { 3812 for_each_std_worker_pool(pool, cpu) {
3793 spin_lock_init(&pool->lock); 3813 init_worker_pool(pool);
3794 pool->cpu = cpu; 3814 pool->cpu = cpu;
3795 pool->flags |= POOL_DISASSOCIATED;
3796 INIT_LIST_HEAD(&pool->worklist);
3797 INIT_LIST_HEAD(&pool->idle_list);
3798 hash_init(pool->busy_hash);
3799
3800 init_timer_deferrable(&pool->idle_timer);
3801 pool->idle_timer.function = idle_worker_timeout;
3802 pool->idle_timer.data = (unsigned long)pool;
3803
3804 setup_timer(&pool->mayday_timer, pool_mayday_timeout,
3805 (unsigned long)pool);
3806
3807 mutex_init(&pool->manager_arb);
3808 mutex_init(&pool->assoc_mutex);
3809 ida_init(&pool->worker_ida);
3810 3815
3811 /* alloc pool ID */ 3816 /* alloc pool ID */
3812 BUG_ON(worker_pool_assign_id(pool)); 3817 BUG_ON(worker_pool_assign_id(pool));