aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/fork.c
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2011-03-22 19:30:41 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-22 20:44:01 -0400
commit504f52b5439aaf26d3e2c1d45ec10fce38c8dd27 (patch)
treecb46d72c50e843c36540c88ef8c9000dff31c1c8 /kernel/fork.c
parent9d502c1c8d47b337c378c2ac8eaeee7918ad16b1 (diff)
mm: NUMA aware alloc_task_struct_node()
All kthreads being created from a single helper task, they all use memory from a single node for their kernel stack and task struct. This patch suite creates kthread_create_on_cpu(), adding a 'cpu' parameter to parameters already used by kthread_create(). This parameter serves in allocating memory for the new kthread on its memory node if available. Users of this new function are : ksoftirqd, kworker, migration, pktgend... This patch: Add a node parameter to alloc_task_struct(), and change its name to alloc_task_struct_node() This change is needed to allow NUMA aware kthread_create_on_cpu() 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> Cc: 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>
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 05b92c457010..cffbe8a4e1fc 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -109,8 +109,10 @@ int nr_processes(void)
109} 109}
110 110
111#ifndef __HAVE_ARCH_TASK_STRUCT_ALLOCATOR 111#ifndef __HAVE_ARCH_TASK_STRUCT_ALLOCATOR
112# define alloc_task_struct() kmem_cache_alloc(task_struct_cachep, GFP_KERNEL) 112# define alloc_task_struct_node(node) \
113# define free_task_struct(tsk) kmem_cache_free(task_struct_cachep, (tsk)) 113 kmem_cache_alloc_node(task_struct_cachep, GFP_KERNEL, node)
114# define free_task_struct(tsk) \
115 kmem_cache_free(task_struct_cachep, (tsk))
114static struct kmem_cache *task_struct_cachep; 116static struct kmem_cache *task_struct_cachep;
115#endif 117#endif
116 118
@@ -249,12 +251,12 @@ static struct task_struct *dup_task_struct(struct task_struct *orig)
249 struct task_struct *tsk; 251 struct task_struct *tsk;
250 struct thread_info *ti; 252 struct thread_info *ti;
251 unsigned long *stackend; 253 unsigned long *stackend;
252 254 int node = numa_node_id();
253 int err; 255 int err;
254 256
255 prepare_to_copy(orig); 257 prepare_to_copy(orig);
256 258
257 tsk = alloc_task_struct(); 259 tsk = alloc_task_struct_node(node);
258 if (!tsk) 260 if (!tsk)
259 return NULL; 261 return NULL;
260 262