aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/fork.c
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2011-03-22 19:30:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-22 20:44:01 -0400
commitb6a84016bd2598e35ead635147fa53619982648d (patch)
treea73dc0ef4e353723bf123898f0fc143e587c16d8 /kernel/fork.c
parent504f52b5439aaf26d3e2c1d45ec10fce38c8dd27 (diff)
mm: NUMA aware alloc_thread_info_node()
Add a node parameter to alloc_thread_info(), and change its name to alloc_thread_info_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.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index cffbe8a4e1f..cbc6adc6e89 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -117,14 +117,17 @@ static struct kmem_cache *task_struct_cachep;
117#endif 117#endif
118 118
119#ifndef __HAVE_ARCH_THREAD_INFO_ALLOCATOR 119#ifndef __HAVE_ARCH_THREAD_INFO_ALLOCATOR
120static inline struct thread_info *alloc_thread_info(struct task_struct *tsk) 120static struct thread_info *alloc_thread_info_node(struct task_struct *tsk,
121 int node)
121{ 122{
122#ifdef CONFIG_DEBUG_STACK_USAGE 123#ifdef CONFIG_DEBUG_STACK_USAGE
123 gfp_t mask = GFP_KERNEL | __GFP_ZERO; 124 gfp_t mask = GFP_KERNEL | __GFP_ZERO;
124#else 125#else
125 gfp_t mask = GFP_KERNEL; 126 gfp_t mask = GFP_KERNEL;
126#endif 127#endif
127 return (struct thread_info *)__get_free_pages(mask, THREAD_SIZE_ORDER); 128 struct page *page = alloc_pages_node(node, mask, THREAD_SIZE_ORDER);
129
130 return page ? page_address(page) : NULL;
128} 131}
129 132
130static inline void free_thread_info(struct thread_info *ti) 133static inline void free_thread_info(struct thread_info *ti)
@@ -260,7 +263,7 @@ static struct task_struct *dup_task_struct(struct task_struct *orig)
260 if (!tsk) 263 if (!tsk)
261 return NULL; 264 return NULL;
262 265
263 ti = alloc_thread_info(tsk); 266 ti = alloc_thread_info_node(tsk, node);
264 if (!ti) { 267 if (!ti) {
265 free_task_struct(tsk); 268 free_task_struct(tsk);
266 return NULL; 269 return NULL;