Skip to content

Commit b6a8401

Browse files
Eric Dumazettorvalds
authored andcommitted
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>
1 parent 504f52b commit b6a8401

19 files changed

Lines changed: 70 additions & 64 deletions

File tree

‎arch/cris/include/asm/thread_info.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ struct thread_info {
6868
#define init_thread_info (init_thread_union.thread_info)
6969

7070
/* thread information allocation */
71-
#define alloc_thread_info(tsk) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1))
71+
#define alloc_thread_info(tsk, node) ((struct thread_info *) __get_free_pages(GFP_KERNEL,1))
7272
#define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
7373

7474
#endif /* !__ASSEMBLY__ */

‎arch/frv/include/asm/thread_info.h‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,11 @@ register struct thread_info *__current_thread_info asm("gr15");
8484

8585
/* thread information allocation */
8686
#ifdef CONFIG_DEBUG_STACK_USAGE
87-
#define alloc_thread_info(tsk) \
88-
({ \
89-
struct thread_info *ret; \
90-
\
91-
ret = kzalloc(THREAD_SIZE, GFP_KERNEL); \
92-
\
93-
ret; \
94-
})
87+
#define alloc_thread_info_node(tsk, node) \
88+
kzalloc_node(THREAD_SIZE, GFP_KERNEL, node)
9589
#else
96-
#define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL)
90+
#define alloc_thread_info_node(tsk) \
91+
kmalloc_node(THREAD_SIZE, GFP_KERNEL, node)
9792
#endif
9893

9994
#define free_thread_info(info) kfree(info)

‎arch/ia64/include/asm/thread_info.h‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,12 @@ struct thread_info {
5959
#ifndef ASM_OFFSETS_C
6060
/* how to get the thread information struct from C */
6161
#define current_thread_info() ((struct thread_info *) ((char *) current + IA64_TASK_SIZE))
62-
#define alloc_thread_info(tsk) ((struct thread_info *) ((char *) (tsk) + IA64_TASK_SIZE))
62+
#define alloc_thread_info_node(tsk, node) \
63+
((struct thread_info *) ((char *) (tsk) + IA64_TASK_SIZE))
6364
#define task_thread_info(tsk) ((struct thread_info *) ((char *) (tsk) + IA64_TASK_SIZE))
6465
#else
6566
#define current_thread_info() ((struct thread_info *) 0)
66-
#define alloc_thread_info(tsk) ((struct thread_info *) 0)
67+
#define alloc_thread_info_node(tsk, node) ((struct thread_info *) 0)
6768
#define task_thread_info(tsk) ((struct thread_info *) 0)
6869
#endif
6970
#define free_thread_info(ti) /* nothing */

‎arch/m32r/include/asm/thread_info.h‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,11 @@ static inline struct thread_info *current_thread_info(void)
9696

9797
/* thread information allocation */
9898
#ifdef CONFIG_DEBUG_STACK_USAGE
99-
#define alloc_thread_info(tsk) \
100-
({ \
101-
struct thread_info *ret; \
102-
\
103-
ret = kzalloc(THREAD_SIZE, GFP_KERNEL); \
104-
\
105-
ret; \
106-
})
99+
#define alloc_thread_info_node(tsk, node) \
100+
kzalloc_node(THREAD_SIZE, GFP_KERNEL, node)
107101
#else
108-
#define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL)
102+
#define alloc_thread_info_node(tsk, node) \
103+
kmalloc_node(THREAD_SIZE, GFP_KERNEL, node)
109104
#endif
110105

111106
#define free_thread_info(info) kfree(info)

‎arch/mips/include/asm/thread_info.h‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,11 @@ register struct thread_info *__current_thread_info __asm__("$28");
8888
#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
8989

9090
#ifdef CONFIG_DEBUG_STACK_USAGE
91-
#define alloc_thread_info(tsk) kzalloc(THREAD_SIZE, GFP_KERNEL)
91+
#define alloc_thread_info_node(tsk, node) \
92+
kzalloc_node(THREAD_SIZE, GFP_KERNEL, node)
9293
#else
93-
#define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL)
94+
#define alloc_thread_info_node(tsk, node) \
95+
kmalloc_node(THREAD_SIZE, GFP_KERNEL, node)
9496
#endif
9597

9698
#define free_thread_info(info) kfree(info)

‎arch/mn10300/include/asm/thread_info.h‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,11 @@ static inline unsigned long current_stack_pointer(void)
124124

125125
/* thread information allocation */
126126
#ifdef CONFIG_DEBUG_STACK_USAGE
127-
#define alloc_thread_info(tsk) kzalloc(THREAD_SIZE, GFP_KERNEL)
127+
#define alloc_thread_info_node(tsk, node) \
128+
kzalloc_node(THREAD_SIZE, GFP_KERNEL, node)
128129
#else
129-
#define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL)
130+
#define alloc_thread_info_node(tsk, node) \
131+
kmalloc_node(THREAD_SIZE, GFP_KERNEL, node)
130132
#endif
131133

132134
#define free_thread_info(ti) kfree((ti))

‎arch/powerpc/include/asm/thread_info.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ struct thread_info {
7272

7373
#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
7474

75-
extern struct thread_info *alloc_thread_info(struct task_struct *tsk);
75+
extern struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node);
7676
extern void free_thread_info(struct thread_info *ti);
7777

7878
#endif /* THREAD_SHIFT < PAGE_SHIFT */

‎arch/powerpc/kernel/process.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,11 +1218,11 @@ void __ppc64_runlatch_off(void)
12181218

12191219
static struct kmem_cache *thread_info_cache;
12201220

1221-
struct thread_info *alloc_thread_info(struct task_struct *tsk)
1221+
struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node)
12221222
{
12231223
struct thread_info *ti;
12241224

1225-
ti = kmem_cache_alloc(thread_info_cache, GFP_KERNEL);
1225+
ti = kmem_cache_alloc_node(thread_info_cache, GFP_KERNEL, node);
12261226
if (unlikely(ti == NULL))
12271227
return NULL;
12281228
#ifdef CONFIG_DEBUG_STACK_USAGE

‎arch/score/include/asm/thread_info.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ struct thread_info {
7171
register struct thread_info *__current_thread_info __asm__("r28");
7272
#define current_thread_info() __current_thread_info
7373

74-
#define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL)
74+
#define alloc_thread_info_node(tsk, node) kmalloc_node(THREAD_SIZE, GFP_KERNEL, node)
7575
#define free_thread_info(info) kfree(info)
7676

7777
#endif /* !__ASSEMBLY__ */

‎arch/sh/include/asm/thread_info.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ static inline struct thread_info *current_thread_info(void)
9595

9696
#endif
9797

98-
extern struct thread_info *alloc_thread_info(struct task_struct *tsk);
98+
extern struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node);
9999
extern void free_thread_info(struct thread_info *ti);
100100
extern void arch_task_cache_init(void);
101101
#define arch_task_cache_init arch_task_cache_init

0 commit comments

Comments
 (0)