kthread: use kthread_create_on_node()
authorEric Dumazet <eric.dumazet@gmail.com>
Tue, 22 Mar 2011 23:30:45 +0000 (16:30 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 23 Mar 2011 00:44:01 +0000 (17:44 -0700)
ksoftirqd, kworker, migration, and pktgend kthreads can be created with
kthread_create_on_node(), to get proper NUMA affinities for their stack and
task_struct.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Acked-by: David S. Miller <davem@davemloft.net>
Reviewed-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
Acked-by: Tejun Heo <tj@kernel.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: David Howells <dhowells@redhat.com>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/softirq.c
kernel/stop_machine.c
kernel/workqueue.c
net/core/pktgen.c

index 56e5dec837f05bd28f90221e2f0b666af23378c9..735d8709517228195b8a95f737bf555e7de712c3 100644 (file)
@@ -845,7 +845,10 @@ 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_node(run_ksoftirqd,
+                                          hcpu,
+                                          cpu_to_node(hotcpu),
+                                          "ksoftirqd/%d", hotcpu);
                if (IS_ERR(p)) {
                        printk("ksoftirqd for %i failed\n", hotcpu);
                        return notifier_from_errno(PTR_ERR(p));
index 2df820b03beb17499afccd6c3acc59e08bfd0194..e3516b29076cc38763a99c3584a02b8544f7b5d4 100644 (file)
@@ -301,8 +301,10 @@ 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_node(cpu_stopper_thread,
+                                          stopper,
+                                          cpu_to_node(cpu),
+                                          "migration/%d", cpu);
                if (IS_ERR(p))
                        return notifier_from_errno(PTR_ERR(p));
                get_task_struct(p);
index 5ca7ce9ce754d5bc66ccea708dea458885d0f86a..04ef830690eceea974d90add3de55b57bc4048f6 100644 (file)
@@ -1366,8 +1366,10 @@ 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_node(worker_thread,
+                                                     worker,
+                                                     cpu_to_node(gcwq->cpu),
+                                                     "kworker/%u:%d", gcwq->cpu, id);
        else
                worker->task = kthread_create(worker_thread, worker,
                                              "kworker/u:%d", id);
index 0c55eaa70e39568a7ee2e280675cd8c01cf547b6..aeeece72b72fa25d29dfd3162a2f9c3a8ef6fcbd 100644 (file)
@@ -3761,7 +3761,10 @@ 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_node(pktgen_thread_worker,
+                                  t,
+                                  cpu_to_node(cpu),
+                                  "kpktgend_%d", cpu);
        if (IS_ERR(p)) {
                pr_err("kernel_thread() failed for cpu %d\n", t->cpu);
                list_del(&t->th_list);