aboutsummaryrefslogtreecommitdiffstats
path: root/arch
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 /arch
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 'arch')
-rw-r--r--arch/frv/include/asm/processor.h2
-rw-r--r--arch/frv/kernel/process.c5
-rw-r--r--arch/ia64/include/asm/thread_info.h9
-rw-r--r--arch/um/include/asm/processor-generic.h2
4 files changed, 13 insertions, 5 deletions
diff --git a/arch/frv/include/asm/processor.h b/arch/frv/include/asm/processor.h
index 3744f2e47f48..4b789ab182b0 100644
--- a/arch/frv/include/asm/processor.h
+++ b/arch/frv/include/asm/processor.h
@@ -137,7 +137,7 @@ unsigned long get_wchan(struct task_struct *p);
137#define KSTK_ESP(tsk) ((tsk)->thread.frame0->sp) 137#define KSTK_ESP(tsk) ((tsk)->thread.frame0->sp)
138 138
139/* Allocation and freeing of basic task resources. */ 139/* Allocation and freeing of basic task resources. */
140extern struct task_struct *alloc_task_struct(void); 140extern struct task_struct *alloc_task_struct_node(int node);
141extern void free_task_struct(struct task_struct *p); 141extern void free_task_struct(struct task_struct *p);
142 142
143#define cpu_relax() barrier() 143#define cpu_relax() barrier()
diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c
index efad12071c2e..9d3597526467 100644
--- a/arch/frv/kernel/process.c
+++ b/arch/frv/kernel/process.c
@@ -44,9 +44,10 @@ asmlinkage void ret_from_fork(void);
44void (*pm_power_off)(void); 44void (*pm_power_off)(void);
45EXPORT_SYMBOL(pm_power_off); 45EXPORT_SYMBOL(pm_power_off);
46 46
47struct task_struct *alloc_task_struct(void) 47struct task_struct *alloc_task_struct_node(int node)
48{ 48{
49 struct task_struct *p = kmalloc(THREAD_SIZE, GFP_KERNEL); 49 struct task_struct *p = kmalloc_node(THREAD_SIZE, GFP_KERNEL, node);
50
50 if (p) 51 if (p)
51 atomic_set((atomic_t *)(p+1), 1); 52 atomic_set((atomic_t *)(p+1), 1);
52 return p; 53 return p;
diff --git a/arch/ia64/include/asm/thread_info.h b/arch/ia64/include/asm/thread_info.h
index b6a5ba2aca34..342004bbefe7 100644
--- a/arch/ia64/include/asm/thread_info.h
+++ b/arch/ia64/include/asm/thread_info.h
@@ -84,7 +84,14 @@ struct thread_info {
84#define end_of_stack(p) (unsigned long *)((void *)(p) + IA64_RBS_OFFSET) 84#define end_of_stack(p) (unsigned long *)((void *)(p) + IA64_RBS_OFFSET)
85 85
86#define __HAVE_ARCH_TASK_STRUCT_ALLOCATOR 86#define __HAVE_ARCH_TASK_STRUCT_ALLOCATOR
87#define alloc_task_struct() ((struct task_struct *)__get_free_pages(GFP_KERNEL | __GFP_COMP, KERNEL_STACK_SIZE_ORDER)) 87#define alloc_task_struct_node(node) \
88({ \
89 struct page *page = alloc_pages_node(node, GFP_KERNEL | __GFP_COMP, \
90 KERNEL_STACK_SIZE_ORDER); \
91 struct task_struct *ret = page ? page_address(page) : NULL; \
92 \
93 ret;
94})
88#define free_task_struct(tsk) free_pages((unsigned long) (tsk), KERNEL_STACK_SIZE_ORDER) 95#define free_task_struct(tsk) free_pages((unsigned long) (tsk), KERNEL_STACK_SIZE_ORDER)
89 96
90#endif /* !__ASSEMBLY */ 97#endif /* !__ASSEMBLY */
diff --git a/arch/um/include/asm/processor-generic.h b/arch/um/include/asm/processor-generic.h
index bed668824b5f..d1d1b0d8a0cd 100644
--- a/arch/um/include/asm/processor-generic.h
+++ b/arch/um/include/asm/processor-generic.h
@@ -66,7 +66,7 @@ struct thread_struct {
66 .request = { 0 } \ 66 .request = { 0 } \
67} 67}
68 68
69extern struct task_struct *alloc_task_struct(void); 69extern struct task_struct *alloc_task_struct_node(int node);
70 70
71static inline void release_thread(struct task_struct *task) 71static inline void release_thread(struct task_struct *task)
72{ 72{