From: Eric Dumazet <eric.dumazet@gmail.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
netdev <netdev@vger.kernel.org>,
David Miller <davem@davemloft.net>, Tejun Heo <tj@kernel.org>,
Rusty Russell <rusty@rustcorp.com.au>,
linux-arch@vger.kernel.org
Subject: [PATCH v2 4/4] kthread: use kthread_create_on_cpu()
Date: Mon, 29 Nov 2010 16:15:19 +0100 [thread overview]
Message-ID: <1291043719.3435.981.camel@edumazet-laptop> (raw)
In-Reply-To: <1291023532.3435.29.camel@edumazet-laptop>
ksoftirqd, kworker, migration, and pktgend kthreads can be created with
kthread_create_on_cpu(), to get proper NUMA affinities for their stack
and task_struct.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: David Miller <davem@davemloft.net>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Tejun Heo <tj@kernel.org>
Cc: linux-arch@vger.kernel.org
---
kernel/softirq.c | 3 ++-
kernel/stop_machine.c | 4 ++--
kernel/workqueue.c | 4 ++--
net/core/pktgen.c | 3 ++-
4 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/kernel/softirq.c b/kernel/softirq.c
index 18f4be0..b2b7044 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -831,7 +831,8 @@ static int __cpuinit cpu_callback(struct notifier_block *nfb,
switch (action) {
case CPU_UP_PREPARE:
case CPU_UP_PREPARE_FROZEN:
- p = kthread_create(run_ksoftirqd, hcpu, "ksoftirqd/%d", hotcpu);
+ p = kthread_create_on_cpu(run_ksoftirqd, hcpu, hotcpu,
+ "ksoftirqd/%d", hotcpu);
if (IS_ERR(p)) {
printk("ksoftirqd for %i failed\n", hotcpu);
return notifier_from_errno(PTR_ERR(p));
diff --git a/kernel/stop_machine.c b/kernel/stop_machine.c
index 2df820b..7c0f287 100644
--- a/kernel/stop_machine.c
+++ b/kernel/stop_machine.c
@@ -301,8 +301,8 @@ static int __cpuinit cpu_stop_cpu_callback(struct notifier_block *nfb,
case CPU_UP_PREPARE:
BUG_ON(stopper->thread || stopper->enabled ||
!list_empty(&stopper->works));
- p = kthread_create(cpu_stopper_thread, stopper, "migration/%d",
- cpu);
+ p = kthread_create_on_cpu(cpu_stopper_thread, stopper, cpu,
+ "migration/%d", cpu);
if (IS_ERR(p))
return notifier_from_errno(PTR_ERR(p));
get_task_struct(p);
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 90db1bd..c8feaf4 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -1318,8 +1318,8 @@ static struct worker *create_worker(struct global_cwq *gcwq, bool bind)
worker->id = id;
if (!on_unbound_cpu)
- worker->task = kthread_create(worker_thread, worker,
- "kworker/%u:%d", gcwq->cpu, id);
+ worker->task = kthread_create_on_cpu(worker_thread, worker, gcwq->cpu,
+ "kworker/%u:%d", gcwq->cpu, id);
else
worker->task = kthread_create(worker_thread, worker,
"kworker/u:%d", id);
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 33bc382..c921fe9 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -3785,7 +3785,8 @@ static int __init pktgen_create_thread(int cpu)
list_add_tail(&t->th_list, &pktgen_threads);
init_completion(&t->start_done);
- p = kthread_create(pktgen_thread_worker, t, "kpktgend_%d", cpu);
+ p = kthread_create_on_cpu(pktgen_thread_worker, t, cpu,
+ "kpktgend_%d", cpu);
if (IS_ERR(p)) {
pr_err("kernel_thread() failed for cpu %d\n", t->cpu);
list_del(&t->th_list);
next prev parent reply other threads:[~2010-11-29 15:15 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-28 19:33 [PATCH] kthread: NUMA aware kthread_create_on_cpu() Eric Dumazet
2010-11-28 22:40 ` Andi Kleen
2010-11-28 22:51 ` Eric Dumazet
2010-11-28 23:01 ` Andi Kleen
2010-11-28 23:37 ` Eric Dumazet
2010-11-29 9:05 ` Andi Kleen
2010-11-29 9:38 ` Eric Dumazet
2010-11-29 15:13 ` [PATCH v2 0/4] " Eric Dumazet
2010-11-29 16:09 ` Andi Kleen
2010-11-29 17:39 ` David Miller
2010-11-29 17:59 ` Eric Dumazet
2010-11-29 23:31 ` Rusty Russell
2010-11-29 15:13 ` [PATCH v2 1/4] mm: NUMA aware alloc_task_struct_node() Eric Dumazet
2010-11-29 15:14 ` [PATCH v2 2/4] mm: NUMA aware alloc_thread_info_node() Eric Dumazet
2010-11-29 15:14 ` [PATCH v2 3/4] kthread: NUMA aware kthread_create_on_cpu() Eric Dumazet
2010-12-10 0:44 ` Andrew Morton
2010-12-10 5:59 ` Eric Dumazet
2010-12-10 6:32 ` Andrew Morton
2010-12-10 7:02 ` Eric Dumazet
2010-12-10 7:09 ` Andrew Morton
2010-12-13 6:26 ` Thomas Fjellstrom
2010-11-29 15:15 ` Eric Dumazet [this message]
2010-11-29 15:19 ` [PATCH v2 4/4] kthread: use kthread_create_on_cpu() Tejun Heo
2010-11-30 9:38 ` David Howells
2010-11-30 9:59 ` Eric Dumazet
2010-11-29 9:03 ` [PATCH] kthread: NUMA aware kthread_create_on_cpu() Américo Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1291043719.3435.981.camel@edumazet-laptop \
--to=eric.dumazet@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=andi@firstfloor.org \
--cc=davem@davemloft.net \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox