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>
This commit is contained in:
parent
9c34a7042e
commit
f7537df520
@ -1595,11 +1595,11 @@ static void worker_leave_idle(struct worker *worker)
|
|||||||
list_del_init(&worker->entry);
|
list_del_init(&worker->entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct worker *alloc_worker(void)
|
static struct worker *alloc_worker(int node)
|
||||||
{
|
{
|
||||||
struct worker *worker;
|
struct worker *worker;
|
||||||
|
|
||||||
worker = kzalloc(sizeof(*worker), GFP_KERNEL);
|
worker = kzalloc_node(sizeof(*worker), GFP_KERNEL, node);
|
||||||
if (worker) {
|
if (worker) {
|
||||||
INIT_LIST_HEAD(&worker->entry);
|
INIT_LIST_HEAD(&worker->entry);
|
||||||
INIT_LIST_HEAD(&worker->scheduled);
|
INIT_LIST_HEAD(&worker->scheduled);
|
||||||
@ -1694,7 +1694,7 @@ static struct worker *create_worker(struct worker_pool *pool)
|
|||||||
if (id < 0)
|
if (id < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
worker = alloc_worker();
|
worker = alloc_worker(pool->node);
|
||||||
if (!worker)
|
if (!worker)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
@ -4110,7 +4110,7 @@ struct workqueue_struct *__alloc_workqueue_key(const char *fmt,
|
|||||||
if (flags & WQ_MEM_RECLAIM) {
|
if (flags & WQ_MEM_RECLAIM) {
|
||||||
struct worker *rescuer;
|
struct worker *rescuer;
|
||||||
|
|
||||||
rescuer = alloc_worker();
|
rescuer = alloc_worker(NUMA_NO_NODE);
|
||||||
if (!rescuer)
|
if (!rescuer)
|
||||||
goto err_destroy;
|
goto err_destroy;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user