aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/cris/include/asm/thread_info.h2
-rw-r--r--arch/frv/include/asm/thread_info.h13
-rw-r--r--arch/ia64/include/asm/thread_info.h5
-rw-r--r--arch/m32r/include/asm/thread_info.h13
-rw-r--r--arch/mips/include/asm/thread_info.h6
-rw-r--r--arch/mn10300/include/asm/thread_info.h6
-rw-r--r--arch/powerpc/include/asm/thread_info.h2
-rw-r--r--arch/powerpc/kernel/process.c4
-rw-r--r--arch/score/include/asm/thread_info.h2
-rw-r--r--arch/sh/include/asm/thread_info.h2
-rw-r--r--arch/sh/kernel/process.c16
-rw-r--r--arch/sparc/include/asm/thread_info_32.h6
-rw-r--r--arch/sparc/include/asm/thread_info_64.h24
-rw-r--r--arch/sparc/mm/srmmu.c4
-rw-r--r--arch/sparc/mm/sun4c.c4
-rw-r--r--arch/tile/include/asm/thread_info.h2
-rw-r--r--arch/tile/kernel/process.c4
-rw-r--r--arch/x86/include/asm/thread_info.h10
-rw-r--r--kernel/fork.c9
19 files changed, 70 insertions, 64 deletions
diff --git a/arch/cris/include/asm/thread_info.h b/arch/cris/include/asm/thread_info.h
index 91776069ca80..29b74a105830 100644
--- a/arch/cris/include/asm/thread_info.h
+++ b/arch/cris/include/asm/thread_info.h
@@ -68,7 +68,7 @@ struct thread_info {
68#define init_thread_info (init_thread_union.thread_info) 68#define init_thread_info (init_thread_union.thread_info)
69 69
70/* thread information allocation */ 70/* 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))
72#define free_thread_info(ti) free_pages((unsigned long) (ti), 1) 72#define free_thread_info(ti) free_pages((unsigned long) (ti), 1)
73 73
74#endif /* !__ASSEMBLY__ */ 74#endif /* !__ASSEMBLY__ */
diff --git a/arch/frv/include/asm/thread_info.h b/arch/frv/include/asm/thread_info.h
index 11f33ead29bf..8582e9c7531c 100644
--- a/arch/frv/include/asm/thread_info.h
+++ b/arch/frv/include/asm/thread_info.h
@@ -84,16 +84,11 @@ register struct thread_info *__current_thread_info asm("gr15");
84 84
85/* thread information allocation */ 85/* thread information allocation */
86#ifdef CONFIG_DEBUG_STACK_USAGE 86#ifdef CONFIG_DEBUG_STACK_USAGE
87#define alloc_thread_info(tsk) \ 87#define alloc_thread_info_node(tsk, node) \
88 ({ \ 88 kzalloc_node(THREAD_SIZE, GFP_KERNEL, node)
89 struct thread_info *ret; \
90 \
91 ret = kzalloc(THREAD_SIZE, GFP_KERNEL); \
92 \
93 ret; \
94 })
95#else 89#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)
97#endif 92#endif
98 93
99#define free_thread_info(info) kfree(info) 94#define free_thread_info(info) kfree(info)
diff --git a/arch/ia64/include/asm/thread_info.h b/arch/ia64/include/asm/thread_info.h
index 342004bbefe7..6392908e8f98 100644
--- a/arch/ia64/include/asm/thread_info.h
+++ b/arch/ia64/include/asm/thread_info.h
@@ -59,11 +59,12 @@ struct thread_info {
59#ifndef ASM_OFFSETS_C 59#ifndef ASM_OFFSETS_C
60/* how to get the thread information struct from C */ 60/* how to get the thread information struct from C */
61#define current_thread_info() ((struct thread_info *) ((char *) current + IA64_TASK_SIZE)) 61#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))
63#define task_thread_info(tsk) ((struct thread_info *) ((char *) (tsk) + IA64_TASK_SIZE)) 64#define task_thread_info(tsk) ((struct thread_info *) ((char *) (tsk) + IA64_TASK_SIZE))
64#else 65#else
65#define current_thread_info() ((struct thread_info *) 0) 66#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)
67#define task_thread_info(tsk) ((struct thread_info *) 0) 68#define task_thread_info(tsk) ((struct thread_info *) 0)
68#endif 69#endif
69#define free_thread_info(ti) /* nothing */ 70#define free_thread_info(ti) /* nothing */
diff --git a/arch/m32r/include/asm/thread_info.h b/arch/m32r/include/asm/thread_info.h
index 71faff5bcc27..0227dba44068 100644
--- a/arch/m32r/include/asm/thread_info.h
+++ b/arch/m32r/include/asm/thread_info.h
@@ -96,16 +96,11 @@ static inline struct thread_info *current_thread_info(void)
96 96
97/* thread information allocation */ 97/* thread information allocation */
98#ifdef CONFIG_DEBUG_STACK_USAGE 98#ifdef CONFIG_DEBUG_STACK_USAGE
99#define alloc_thread_info(tsk) \ 99#define alloc_thread_info_node(tsk, node) \
100 ({ \ 100 kzalloc_node(THREAD_SIZE, GFP_KERNEL, node)
101 struct thread_info *ret; \
102 \
103 ret = kzalloc(THREAD_SIZE, GFP_KERNEL); \
104 \
105 ret; \
106 })
107#else 101#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)
109#endif 104#endif
110 105
111#define free_thread_info(info) kfree(info) 106#define free_thread_info(info) kfree(info)
diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h
index d309556cacf8..d71160de4d10 100644
--- a/arch/mips/include/asm/thread_info.h
+++ b/arch/mips/include/asm/thread_info.h
@@ -88,9 +88,11 @@ register struct thread_info *__current_thread_info __asm__("$28");
88#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR 88#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
89 89
90#ifdef CONFIG_DEBUG_STACK_USAGE 90#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)
92#else 93#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)
94#endif 96#endif
95 97
96#define free_thread_info(info) kfree(info) 98#define free_thread_info(info) kfree(info)
diff --git a/arch/mn10300/include/asm/thread_info.h b/arch/mn10300/include/asm/thread_info.h
index aa07a4a5d794..8d53f09c878d 100644
--- a/arch/mn10300/include/asm/thread_info.h
+++ b/arch/mn10300/include/asm/thread_info.h
@@ -124,9 +124,11 @@ static inline unsigned long current_stack_pointer(void)
124 124
125/* thread information allocation */ 125/* thread information allocation */
126#ifdef CONFIG_DEBUG_STACK_USAGE 126#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)
128#else 129#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)
130#endif 132#endif
131 133
132#define free_thread_info(ti) kfree((ti)) 134#define free_thread_info(ti) kfree((ti))
diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h
index 65eb85976a03..d8529ef13b23 100644
--- a/arch/powerpc/include/asm/thread_info.h
+++ b/arch/powerpc/include/asm/thread_info.h
@@ -72,7 +72,7 @@ struct thread_info {
72 72
73#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR 73#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
74 74
75extern struct thread_info *alloc_thread_info(struct task_struct *tsk); 75extern struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node);
76extern void free_thread_info(struct thread_info *ti); 76extern void free_thread_info(struct thread_info *ti);
77 77
78#endif /* THREAD_SHIFT < PAGE_SHIFT */ 78#endif /* THREAD_SHIFT < PAGE_SHIFT */
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 8303a6c65ef7..f74f355a9617 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1218,11 +1218,11 @@ void __ppc64_runlatch_off(void)
1218 1218
1219static struct kmem_cache *thread_info_cache; 1219static struct kmem_cache *thread_info_cache;
1220 1220
1221struct thread_info *alloc_thread_info(struct task_struct *tsk) 1221struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node)
1222{ 1222{
1223 struct thread_info *ti; 1223 struct thread_info *ti;
1224 1224
1225 ti = kmem_cache_alloc(thread_info_cache, GFP_KERNEL); 1225 ti = kmem_cache_alloc_node(thread_info_cache, GFP_KERNEL, node);
1226 if (unlikely(ti == NULL)) 1226 if (unlikely(ti == NULL))
1227 return NULL; 1227 return NULL;
1228#ifdef CONFIG_DEBUG_STACK_USAGE 1228#ifdef CONFIG_DEBUG_STACK_USAGE
diff --git a/arch/score/include/asm/thread_info.h b/arch/score/include/asm/thread_info.h
index 8570d08f58c1..2205c62284db 100644
--- a/arch/score/include/asm/thread_info.h
+++ b/arch/score/include/asm/thread_info.h
@@ -71,7 +71,7 @@ struct thread_info {
71register struct thread_info *__current_thread_info __asm__("r28"); 71register struct thread_info *__current_thread_info __asm__("r28");
72#define current_thread_info() __current_thread_info 72#define current_thread_info() __current_thread_info
73 73
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)
75#define free_thread_info(info) kfree(info) 75#define free_thread_info(info) kfree(info)
76 76
77#endif /* !__ASSEMBLY__ */ 77#endif /* !__ASSEMBLY__ */
diff --git a/arch/sh/include/asm/thread_info.h b/arch/sh/include/asm/thread_info.h
index c228946926ed..ea2d5089de1e 100644
--- a/arch/sh/include/asm/thread_info.h
+++ b/arch/sh/include/asm/thread_info.h
@@ -95,7 +95,7 @@ static inline struct thread_info *current_thread_info(void)
95 95
96#endif 96#endif
97 97
98extern struct thread_info *alloc_thread_info(struct task_struct *tsk); 98extern struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node);
99extern void free_thread_info(struct thread_info *ti); 99extern void free_thread_info(struct thread_info *ti);
100extern void arch_task_cache_init(void); 100extern void arch_task_cache_init(void);
101#define arch_task_cache_init arch_task_cache_init 101#define arch_task_cache_init arch_task_cache_init
diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c
index dcb126dc76fd..f39ad57296b7 100644
--- a/arch/sh/kernel/process.c
+++ b/arch/sh/kernel/process.c
@@ -32,16 +32,16 @@ void free_thread_xstate(struct task_struct *tsk)
32#if THREAD_SHIFT < PAGE_SHIFT 32#if THREAD_SHIFT < PAGE_SHIFT
33static struct kmem_cache *thread_info_cache; 33static struct kmem_cache *thread_info_cache;
34 34
35struct thread_info *alloc_thread_info(struct task_struct *tsk) 35struct thread_info *alloc_thread_info(struct task_struct *tsk, int node)
36{ 36{
37 struct thread_info *ti; 37 struct thread_info *ti;
38
39 ti = kmem_cache_alloc(thread_info_cache, GFP_KERNEL);
40 if (unlikely(ti == NULL))
41 return NULL;
42#ifdef CONFIG_DEBUG_STACK_USAGE 38#ifdef CONFIG_DEBUG_STACK_USAGE
43 memset(ti, 0, THREAD_SIZE); 39 gfp_t mask = GFP_KERNEL | __GFP_ZERO;
40#else
41 gfp_t mask = GFP_KERNEL;
44#endif 42#endif
43
44 ti = kmem_cache_alloc_node(thread_info_cache, mask, node);
45 return ti; 45 return ti;
46} 46}
47 47
@@ -64,7 +64,9 @@ struct thread_info *alloc_thread_info(struct task_struct *tsk)
64#else 64#else
65 gfp_t mask = GFP_KERNEL; 65 gfp_t mask = GFP_KERNEL;
66#endif 66#endif
67 return (struct thread_info *)__get_free_pages(mask, THREAD_SIZE_ORDER); 67 struct page *page = alloc_pages_node(node, mask, THREAD_SIZE_ORDER);
68
69 return page ? page_address(page) : NULL;
68} 70}
69 71
70void free_thread_info(struct thread_info *ti) 72void free_thread_info(struct thread_info *ti)
diff --git a/arch/sparc/include/asm/thread_info_32.h b/arch/sparc/include/asm/thread_info_32.h
index 9dd0318d3ddf..fa5753233410 100644
--- a/arch/sparc/include/asm/thread_info_32.h
+++ b/arch/sparc/include/asm/thread_info_32.h
@@ -82,8 +82,8 @@ register struct thread_info *current_thread_info_reg asm("g6");
82 82
83#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR 83#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
84 84
85BTFIXUPDEF_CALL(struct thread_info *, alloc_thread_info, void) 85BTFIXUPDEF_CALL(struct thread_info *, alloc_thread_info_node, int)
86#define alloc_thread_info(tsk) BTFIXUP_CALL(alloc_thread_info)() 86#define alloc_thread_info_node(tsk, node) BTFIXUP_CALL(alloc_thread_info_node)(node)
87 87
88BTFIXUPDEF_CALL(void, free_thread_info, struct thread_info *) 88BTFIXUPDEF_CALL(void, free_thread_info, struct thread_info *)
89#define free_thread_info(ti) BTFIXUP_CALL(free_thread_info)(ti) 89#define free_thread_info(ti) BTFIXUP_CALL(free_thread_info)(ti)
@@ -92,7 +92,7 @@ BTFIXUPDEF_CALL(void, free_thread_info, struct thread_info *)
92 92
93/* 93/*
94 * Size of kernel stack for each process. 94 * Size of kernel stack for each process.
95 * Observe the order of get_free_pages() in alloc_thread_info(). 95 * Observe the order of get_free_pages() in alloc_thread_info_node().
96 * The sun4 has 8K stack too, because it's short on memory, and 16K is a waste. 96 * The sun4 has 8K stack too, because it's short on memory, and 16K is a waste.
97 */ 97 */
98#define THREAD_SIZE 8192 98#define THREAD_SIZE 8192
diff --git a/arch/sparc/include/asm/thread_info_64.h b/arch/sparc/include/asm/thread_info_64.h
index fb2ea7705a46..60d86be1a533 100644
--- a/arch/sparc/include/asm/thread_info_64.h
+++ b/arch/sparc/include/asm/thread_info_64.h
@@ -146,21 +146,21 @@ register struct thread_info *current_thread_info_reg asm("g6");
146#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR 146#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
147 147
148#ifdef CONFIG_DEBUG_STACK_USAGE 148#ifdef CONFIG_DEBUG_STACK_USAGE
149#define alloc_thread_info(tsk) \ 149#define THREAD_FLAGS (GFP_KERNEL | __GFP_ZERO)
150({ \
151 struct thread_info *ret; \
152 \
153 ret = (struct thread_info *) \
154 __get_free_pages(GFP_KERNEL, __THREAD_INFO_ORDER); \
155 if (ret) \
156 memset(ret, 0, PAGE_SIZE<<__THREAD_INFO_ORDER); \
157 ret; \
158})
159#else 150#else
160#define alloc_thread_info(tsk) \ 151#define THREAD_FLAGS (GFP_KERNEL)
161 ((struct thread_info *)__get_free_pages(GFP_KERNEL, __THREAD_INFO_ORDER))
162#endif 152#endif
163 153
154#define alloc_thread_info_node(tsk, node) \
155({ \
156 struct page *page = alloc_pages_node(node, THREAD_FLAGS, \
157 __THREAD_INFO_ORDER); \
158 struct thread_info *ret; \
159 \
160 ret = page ? page_address(page) : NULL; \
161 ret; \
162})
163
164#define free_thread_info(ti) \ 164#define free_thread_info(ti) \
165 free_pages((unsigned long)(ti),__THREAD_INFO_ORDER) 165 free_pages((unsigned long)(ti),__THREAD_INFO_ORDER)
166 166
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index 92319aa8b662..fe09fd8be695 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -650,7 +650,7 @@ static void srmmu_unmapiorange(unsigned long virt_addr, unsigned int len)
650 * mappings on the kernel stack without any special code as we did 650 * mappings on the kernel stack without any special code as we did
651 * need on the sun4c. 651 * need on the sun4c.
652 */ 652 */
653static struct thread_info *srmmu_alloc_thread_info(void) 653static struct thread_info *srmmu_alloc_thread_info_node(int node)
654{ 654{
655 struct thread_info *ret; 655 struct thread_info *ret;
656 656
@@ -2271,7 +2271,7 @@ void __init ld_mmu_srmmu(void)
2271 2271
2272 BTFIXUPSET_CALL(mmu_info, srmmu_mmu_info, BTFIXUPCALL_NORM); 2272 BTFIXUPSET_CALL(mmu_info, srmmu_mmu_info, BTFIXUPCALL_NORM);
2273 2273
2274 BTFIXUPSET_CALL(alloc_thread_info, srmmu_alloc_thread_info, BTFIXUPCALL_NORM); 2274 BTFIXUPSET_CALL(alloc_thread_info_node, srmmu_alloc_thread_info_node, BTFIXUPCALL_NORM);
2275 BTFIXUPSET_CALL(free_thread_info, srmmu_free_thread_info, BTFIXUPCALL_NORM); 2275 BTFIXUPSET_CALL(free_thread_info, srmmu_free_thread_info, BTFIXUPCALL_NORM);
2276 2276
2277 BTFIXUPSET_CALL(pte_to_pgoff, srmmu_pte_to_pgoff, BTFIXUPCALL_NORM); 2277 BTFIXUPSET_CALL(pte_to_pgoff, srmmu_pte_to_pgoff, BTFIXUPCALL_NORM);
diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c
index b5137cc2aba3..a2350b5e68aa 100644
--- a/arch/sparc/mm/sun4c.c
+++ b/arch/sparc/mm/sun4c.c
@@ -922,7 +922,7 @@ static inline void garbage_collect(int entry)
922 free_locked_segment(BUCKET_ADDR(entry)); 922 free_locked_segment(BUCKET_ADDR(entry));
923} 923}
924 924
925static struct thread_info *sun4c_alloc_thread_info(void) 925static struct thread_info *sun4c_alloc_thread_info_node(int node)
926{ 926{
927 unsigned long addr, pages; 927 unsigned long addr, pages;
928 int entry; 928 int entry;
@@ -2155,7 +2155,7 @@ void __init ld_mmu_sun4c(void)
2155 BTFIXUPSET_CALL(__swp_offset, sun4c_swp_offset, BTFIXUPCALL_NORM); 2155 BTFIXUPSET_CALL(__swp_offset, sun4c_swp_offset, BTFIXUPCALL_NORM);
2156 BTFIXUPSET_CALL(__swp_entry, sun4c_swp_entry, BTFIXUPCALL_NORM); 2156 BTFIXUPSET_CALL(__swp_entry, sun4c_swp_entry, BTFIXUPCALL_NORM);
2157 2157
2158 BTFIXUPSET_CALL(alloc_thread_info, sun4c_alloc_thread_info, BTFIXUPCALL_NORM); 2158 BTFIXUPSET_CALL(alloc_thread_info_node, sun4c_alloc_thread_info_node, BTFIXUPCALL_NORM);
2159 BTFIXUPSET_CALL(free_thread_info, sun4c_free_thread_info, BTFIXUPCALL_NORM); 2159 BTFIXUPSET_CALL(free_thread_info, sun4c_free_thread_info, BTFIXUPCALL_NORM);
2160 2160
2161 BTFIXUPSET_CALL(mmu_info, sun4c_mmu_info, BTFIXUPCALL_NORM); 2161 BTFIXUPSET_CALL(mmu_info, sun4c_mmu_info, BTFIXUPCALL_NORM);
diff --git a/arch/tile/include/asm/thread_info.h b/arch/tile/include/asm/thread_info.h
index 9e8e9c4dfa2a..3405b52853b8 100644
--- a/arch/tile/include/asm/thread_info.h
+++ b/arch/tile/include/asm/thread_info.h
@@ -84,7 +84,7 @@ register unsigned long stack_pointer __asm__("sp");
84 ((struct thread_info *)(stack_pointer & -THREAD_SIZE)) 84 ((struct thread_info *)(stack_pointer & -THREAD_SIZE))
85 85
86#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR 86#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
87extern struct thread_info *alloc_thread_info(struct task_struct *task); 87extern struct thread_info *alloc_thread_info_node(struct task_struct *task, int node);
88extern void free_thread_info(struct thread_info *info); 88extern void free_thread_info(struct thread_info *info);
89 89
90/* Sit on a nap instruction until interrupted. */ 90/* Sit on a nap instruction until interrupted. */
diff --git a/arch/tile/kernel/process.c b/arch/tile/kernel/process.c
index b9cd962e1d30..d0065103eb7b 100644
--- a/arch/tile/kernel/process.c
+++ b/arch/tile/kernel/process.c
@@ -109,7 +109,7 @@ void cpu_idle(void)
109 } 109 }
110} 110}
111 111
112struct thread_info *alloc_thread_info(struct task_struct *task) 112struct thread_info *alloc_thread_info_node(struct task_struct *task, int node)
113{ 113{
114 struct page *page; 114 struct page *page;
115 gfp_t flags = GFP_KERNEL; 115 gfp_t flags = GFP_KERNEL;
@@ -118,7 +118,7 @@ struct thread_info *alloc_thread_info(struct task_struct *task)
118 flags |= __GFP_ZERO; 118 flags |= __GFP_ZERO;
119#endif 119#endif
120 120
121 page = alloc_pages(flags, THREAD_SIZE_ORDER); 121 page = alloc_pages_node(node, flags, THREAD_SIZE_ORDER);
122 if (!page) 122 if (!page)
123 return NULL; 123 return NULL;
124 124
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
index f0b6e5dbc5a0..1f2e61e28981 100644
--- a/arch/x86/include/asm/thread_info.h
+++ b/arch/x86/include/asm/thread_info.h
@@ -161,8 +161,14 @@ struct thread_info {
161 161
162#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR 162#define __HAVE_ARCH_THREAD_INFO_ALLOCATOR
163 163
164#define alloc_thread_info(tsk) \ 164#define alloc_thread_info_node(tsk, node) \
165 ((struct thread_info *)__get_free_pages(THREAD_FLAGS, THREAD_ORDER)) 165({ \
166 struct page *page = alloc_pages_node(node, THREAD_FLAGS, \
167 THREAD_ORDER); \
168 struct thread_info *ret = page ? page_address(page) : NULL; \
169 \
170 ret; \
171})
166 172
167#ifdef CONFIG_X86_32 173#ifdef CONFIG_X86_32
168 174
diff --git a/kernel/fork.c b/kernel/fork.c
index cffbe8a4e1fc..cbc6adc6e891 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;