diff options
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r-- | kernel/workqueue.c | 37 |
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 | ||
3126 | static 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 | |||
3126 | static int alloc_and_link_pwqs(struct workqueue_struct *wq) | 3146 | static 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)); |