aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/workqueue.c
diff options
context:
space:
mode:
authorLai Jiangshan <laijs@cn.fujitsu.com>2014-07-15 05:24:15 -0400
committerTejun Heo <tj@kernel.org>2014-07-15 11:11:20 -0400
commitf7537df5206929c6a6f878da7c8ecd4143793376 (patch)
treec8e2faea1bf12a67da76598694ce560f57fb66e1 /kernel/workqueue.c
parent9c34a7042e6fe79b900bd44db03dde8a4ecdf6f6 (diff)
workqueue: alloc struct worker on its local node
When the create_worker() is called from non-manager, the struct worker is allocated from the node of the caller which may be different from the node of pool->node. So we add a node ID argument for the alloc_worker() to ensure the struct worker is allocated from the preferable node. tj: @nid renamed to @node for consistency. Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Signed-off-by: Tejun Heo <tj@kernel.org>
Diffstat (limited to 'kernel/workqueue.c')
-rw-r--r--kernel/workqueue.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 338d418ba6aa..a791a8c32b4f 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -1595,11 +1595,11 @@ static void worker_leave_idle(struct worker *worker)
1595 list_del_init(&worker->entry); 1595 list_del_init(&worker->entry);
1596} 1596}
1597 1597
1598static struct worker *alloc_worker(void) 1598static struct worker *alloc_worker(int node)
1599{ 1599{
1600 struct worker *worker; 1600 struct worker *worker;
1601 1601
1602 worker = kzalloc(sizeof(*worker), GFP_KERNEL); 1602 worker = kzalloc_node(sizeof(*worker), GFP_KERNEL, node);
1603 if (worker) { 1603 if (worker) {
1604 INIT_LIST_HEAD(&worker->entry); 1604 INIT_LIST_HEAD(&worker->entry);
1605 INIT_LIST_HEAD(&worker->scheduled); 1605 INIT_LIST_HEAD(&worker->scheduled);
@@ -1694,7 +1694,7 @@ static struct worker *create_worker(struct worker_pool *pool)
1694 if (id < 0) 1694 if (id < 0)
1695 goto fail; 1695 goto fail;
1696 1696
1697 worker = alloc_worker(); 1697 worker = alloc_worker(pool->node);
1698 if (!worker) 1698 if (!worker)
1699 goto fail; 1699 goto fail;
1700 1700
@@ -4110,7 +4110,7 @@ struct workqueue_struct *__alloc_workqueue_key(const char *fmt,
4110 if (flags & WQ_MEM_RECLAIM) { 4110 if (flags & WQ_MEM_RECLAIM) {
4111 struct worker *rescuer; 4111 struct worker *rescuer;
4112 4112
4113 rescuer = alloc_worker(); 4113 rescuer = alloc_worker(NUMA_NO_NODE);
4114 if (!rescuer) 4114 if (!rescuer)
4115 goto err_destroy; 4115 goto err_destroy;
4116 4116