* [PATCH] workqueue: alloc struct worker on its local node
@ 2014-07-15 9:24 Lai Jiangshan
2014-07-15 15:12 ` Tejun Heo
0 siblings, 1 reply; 2+ messages in thread
From: Lai Jiangshan @ 2014-07-15 9:24 UTC (permalink / raw)
To: linux-kernel; +Cc: Tejun Heo, Lai Jiangshan
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.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
kernel/workqueue.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index e83c42a..a4a5364 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -1614,11 +1614,11 @@ static void worker_leave_idle(struct worker *worker)
list_del_init(&worker->entry);
}
-static struct worker *alloc_worker(void)
+static struct worker *alloc_worker(int nid)
{
struct worker *worker;
- worker = kzalloc(sizeof(*worker), GFP_KERNEL);
+ worker = kzalloc_node(sizeof(*worker), GFP_KERNEL, nid);
if (worker) {
INIT_LIST_HEAD(&worker->entry);
INIT_LIST_HEAD(&worker->scheduled);
@@ -1713,7 +1713,7 @@ static struct worker *create_worker(struct worker_pool *pool)
if (id < 0)
goto fail;
- worker = alloc_worker();
+ worker = alloc_worker(pool->node);
if (!worker)
goto fail;
@@ -4129,7 +4129,7 @@ struct workqueue_struct *__alloc_workqueue_key(const char *fmt,
if (flags & WQ_MEM_RECLAIM) {
struct worker *rescuer;
- rescuer = alloc_worker();
+ rescuer = alloc_worker(NUMA_NO_NODE);
if (!rescuer)
goto err_destroy;
--
1.7.4.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] workqueue: alloc struct worker on its local node
2014-07-15 9:24 [PATCH] workqueue: alloc struct worker on its local node Lai Jiangshan
@ 2014-07-15 15:12 ` Tejun Heo
0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2014-07-15 15:12 UTC (permalink / raw)
To: Lai Jiangshan; +Cc: linux-kernel
On Tue, Jul 15, 2014 at 05:24:15PM +0800, Lai Jiangshan wrote:
> 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.
>
> Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
I renamed @nid to @node as everything else in that file is using @node
for node id.
Applied to wq/for-3.17.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-07-15 15:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-15 9:24 [PATCH] workqueue: alloc struct worker on its local node Lai Jiangshan
2014-07-15 15:12 ` Tejun Heo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®