mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-20 21:51:05 +00:00
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>
This commit is contained in:
parent
34a06bd6b6
commit
4e1a1f9a05
1 changed files with 21 additions and 16 deletions
|
@ -3123,6 +3123,26 @@ int keventd_up(void)
|
||||||
return system_wq != NULL;
|
return system_wq != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void init_worker_pool(struct worker_pool *pool)
|
||||||
|
{
|
||||||
|
spin_lock_init(&pool->lock);
|
||||||
|
pool->flags |= POOL_DISASSOCIATED;
|
||||||
|
INIT_LIST_HEAD(&pool->worklist);
|
||||||
|
INIT_LIST_HEAD(&pool->idle_list);
|
||||||
|
hash_init(pool->busy_hash);
|
||||||
|
|
||||||
|
init_timer_deferrable(&pool->idle_timer);
|
||||||
|
pool->idle_timer.function = idle_worker_timeout;
|
||||||
|
pool->idle_timer.data = (unsigned long)pool;
|
||||||
|
|
||||||
|
setup_timer(&pool->mayday_timer, pool_mayday_timeout,
|
||||||
|
(unsigned long)pool);
|
||||||
|
|
||||||
|
mutex_init(&pool->manager_arb);
|
||||||
|
mutex_init(&pool->assoc_mutex);
|
||||||
|
ida_init(&pool->worker_ida);
|
||||||
|
}
|
||||||
|
|
||||||
static int alloc_and_link_pwqs(struct workqueue_struct *wq)
|
static int alloc_and_link_pwqs(struct workqueue_struct *wq)
|
||||||
{
|
{
|
||||||
bool highpri = wq->flags & WQ_HIGHPRI;
|
bool highpri = wq->flags & WQ_HIGHPRI;
|
||||||
|
@ -3790,23 +3810,8 @@ static int __init init_workqueues(void)
|
||||||
struct worker_pool *pool;
|
struct worker_pool *pool;
|
||||||
|
|
||||||
for_each_std_worker_pool(pool, cpu) {
|
for_each_std_worker_pool(pool, cpu) {
|
||||||
spin_lock_init(&pool->lock);
|
init_worker_pool(pool);
|
||||||
pool->cpu = cpu;
|
pool->cpu = cpu;
|
||||||
pool->flags |= POOL_DISASSOCIATED;
|
|
||||||
INIT_LIST_HEAD(&pool->worklist);
|
|
||||||
INIT_LIST_HEAD(&pool->idle_list);
|
|
||||||
hash_init(pool->busy_hash);
|
|
||||||
|
|
||||||
init_timer_deferrable(&pool->idle_timer);
|
|
||||||
pool->idle_timer.function = idle_worker_timeout;
|
|
||||||
pool->idle_timer.data = (unsigned long)pool;
|
|
||||||
|
|
||||||
setup_timer(&pool->mayday_timer, pool_mayday_timeout,
|
|
||||||
(unsigned long)pool);
|
|
||||||
|
|
||||||
mutex_init(&pool->manager_arb);
|
|
||||||
mutex_init(&pool->assoc_mutex);
|
|
||||||
ida_init(&pool->worker_ida);
|
|
||||||
|
|
||||||
/* alloc pool ID */
|
/* alloc pool ID */
|
||||||
BUG_ON(worker_pool_assign_id(pool));
|
BUG_ON(worker_pool_assign_id(pool));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue