diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2012-05-05 11:05:42 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2012-05-08 08:08:44 -0400 |
commit | 38e7c572ce7310def003d8bb7c34260f5d8118cb (patch) | |
tree | 26382e768460c49a09ebe15e57ad3e69a36d1660 /arch | |
parent | 7b8fe0570a65486e77823d5fcec9998c2aae9970 (diff) |
x86: Use common threadinfo allocator
The only difference is the free_thread_info function, which frees
xstate.
Use the new arch_release_task_struct() function instead and switch
over to the core allocator.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20120505150141.559556763@linutronix.de
Cc: x86@kernel.org
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/include/asm/boot.h | 2 | ||||
-rw-r--r-- | arch/x86/include/asm/page_32_types.h | 4 | ||||
-rw-r--r-- | arch/x86/include/asm/page_64_types.h | 4 | ||||
-rw-r--r-- | arch/x86/include/asm/thread_info.h | 20 | ||||
-rw-r--r-- | arch/x86/kernel/irq_32.c | 8 | ||||
-rw-r--r-- | arch/x86/kernel/process.c | 5 |
6 files changed, 12 insertions, 31 deletions
diff --git a/arch/x86/include/asm/boot.h b/arch/x86/include/asm/boot.h index 5e1a2eef3e7c..b13fe63bdc59 100644 --- a/arch/x86/include/asm/boot.h +++ b/arch/x86/include/asm/boot.h | |||
@@ -19,7 +19,7 @@ | |||
19 | #ifdef CONFIG_X86_64 | 19 | #ifdef CONFIG_X86_64 |
20 | #define MIN_KERNEL_ALIGN_LG2 PMD_SHIFT | 20 | #define MIN_KERNEL_ALIGN_LG2 PMD_SHIFT |
21 | #else | 21 | #else |
22 | #define MIN_KERNEL_ALIGN_LG2 (PAGE_SHIFT + THREAD_ORDER) | 22 | #define MIN_KERNEL_ALIGN_LG2 (PAGE_SHIFT + THREAD_SIZE_ORDER) |
23 | #endif | 23 | #endif |
24 | #define MIN_KERNEL_ALIGN (_AC(1, UL) << MIN_KERNEL_ALIGN_LG2) | 24 | #define MIN_KERNEL_ALIGN (_AC(1, UL) << MIN_KERNEL_ALIGN_LG2) |
25 | 25 | ||
diff --git a/arch/x86/include/asm/page_32_types.h b/arch/x86/include/asm/page_32_types.h index ade619ff9e2a..ef17af013475 100644 --- a/arch/x86/include/asm/page_32_types.h +++ b/arch/x86/include/asm/page_32_types.h | |||
@@ -15,8 +15,8 @@ | |||
15 | */ | 15 | */ |
16 | #define __PAGE_OFFSET _AC(CONFIG_PAGE_OFFSET, UL) | 16 | #define __PAGE_OFFSET _AC(CONFIG_PAGE_OFFSET, UL) |
17 | 17 | ||
18 | #define THREAD_ORDER 1 | 18 | #define THREAD_SIZE_ORDER 1 |
19 | #define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER) | 19 | #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) |
20 | 20 | ||
21 | #define STACKFAULT_STACK 0 | 21 | #define STACKFAULT_STACK 0 |
22 | #define DOUBLEFAULT_STACK 1 | 22 | #define DOUBLEFAULT_STACK 1 |
diff --git a/arch/x86/include/asm/page_64_types.h b/arch/x86/include/asm/page_64_types.h index 7639dbf5d223..320f7bb95f76 100644 --- a/arch/x86/include/asm/page_64_types.h +++ b/arch/x86/include/asm/page_64_types.h | |||
@@ -1,8 +1,8 @@ | |||
1 | #ifndef _ASM_X86_PAGE_64_DEFS_H | 1 | #ifndef _ASM_X86_PAGE_64_DEFS_H |
2 | #define _ASM_X86_PAGE_64_DEFS_H | 2 | #define _ASM_X86_PAGE_64_DEFS_H |
3 | 3 | ||
4 | #define THREAD_ORDER 1 | 4 | #define THREAD_SIZE_ORDER 1 |
5 | #define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER) | 5 | #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) |
6 | #define CURRENT_MASK (~(THREAD_SIZE - 1)) | 6 | #define CURRENT_MASK (~(THREAD_SIZE - 1)) |
7 | 7 | ||
8 | #define EXCEPTION_STACK_ORDER 0 | 8 | #define EXCEPTION_STACK_ORDER 0 |
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h index 8692a166dd4e..73cfe0d309c9 100644 --- a/arch/x86/include/asm/thread_info.h +++ b/arch/x86/include/asm/thread_info.h | |||
@@ -155,24 +155,6 @@ struct thread_info { | |||
155 | 155 | ||
156 | #define PREEMPT_ACTIVE 0x10000000 | 156 | #define PREEMPT_ACTIVE 0x10000000 |
157 | 157 | ||
158 | /* thread information allocation */ | ||
159 | #ifdef CONFIG_DEBUG_STACK_USAGE | ||
160 | #define THREAD_FLAGS (GFP_KERNEL | __GFP_NOTRACK | __GFP_ZERO) | ||
161 | #else | ||
162 | #define THREAD_FLAGS (GFP_KERNEL | __GFP_NOTRACK) | ||
163 | #endif | ||
164 | |||
165 | #define __HAVE_ARCH_THREAD_INFO_ALLOCATOR | ||
166 | |||
167 | #define alloc_thread_info_node(tsk, node) \ | ||
168 | ({ \ | ||
169 | struct page *page = alloc_pages_node(node, THREAD_FLAGS, \ | ||
170 | THREAD_ORDER); \ | ||
171 | struct thread_info *ret = page ? page_address(page) : NULL; \ | ||
172 | \ | ||
173 | ret; \ | ||
174 | }) | ||
175 | |||
176 | #ifdef CONFIG_X86_32 | 158 | #ifdef CONFIG_X86_32 |
177 | 159 | ||
178 | #define STACK_WARN (THREAD_SIZE/8) | 160 | #define STACK_WARN (THREAD_SIZE/8) |
@@ -282,7 +264,7 @@ static inline bool is_ia32_task(void) | |||
282 | 264 | ||
283 | #ifndef __ASSEMBLY__ | 265 | #ifndef __ASSEMBLY__ |
284 | extern void arch_task_cache_init(void); | 266 | extern void arch_task_cache_init(void); |
285 | extern void free_thread_info(struct thread_info *ti); | ||
286 | extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src); | 267 | extern int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src); |
268 | extern void arch_release_task_struct(struct task_struct *tsk); | ||
287 | #endif | 269 | #endif |
288 | #endif /* _ASM_X86_THREAD_INFO_H */ | 270 | #endif /* _ASM_X86_THREAD_INFO_H */ |
diff --git a/arch/x86/kernel/irq_32.c b/arch/x86/kernel/irq_32.c index 58b7f27cb3e9..344faf8d0d62 100644 --- a/arch/x86/kernel/irq_32.c +++ b/arch/x86/kernel/irq_32.c | |||
@@ -127,8 +127,8 @@ void __cpuinit irq_ctx_init(int cpu) | |||
127 | return; | 127 | return; |
128 | 128 | ||
129 | irqctx = page_address(alloc_pages_node(cpu_to_node(cpu), | 129 | irqctx = page_address(alloc_pages_node(cpu_to_node(cpu), |
130 | THREAD_FLAGS, | 130 | THREADINFO_GFP, |
131 | THREAD_ORDER)); | 131 | THREAD_SIZE_ORDER)); |
132 | memset(&irqctx->tinfo, 0, sizeof(struct thread_info)); | 132 | memset(&irqctx->tinfo, 0, sizeof(struct thread_info)); |
133 | irqctx->tinfo.cpu = cpu; | 133 | irqctx->tinfo.cpu = cpu; |
134 | irqctx->tinfo.preempt_count = HARDIRQ_OFFSET; | 134 | irqctx->tinfo.preempt_count = HARDIRQ_OFFSET; |
@@ -137,8 +137,8 @@ void __cpuinit irq_ctx_init(int cpu) | |||
137 | per_cpu(hardirq_ctx, cpu) = irqctx; | 137 | per_cpu(hardirq_ctx, cpu) = irqctx; |
138 | 138 | ||
139 | irqctx = page_address(alloc_pages_node(cpu_to_node(cpu), | 139 | irqctx = page_address(alloc_pages_node(cpu_to_node(cpu), |
140 | THREAD_FLAGS, | 140 | THREADINFO_GFP, |
141 | THREAD_ORDER)); | 141 | THREAD_SIZE_ORDER)); |
142 | memset(&irqctx->tinfo, 0, sizeof(struct thread_info)); | 142 | memset(&irqctx->tinfo, 0, sizeof(struct thread_info)); |
143 | irqctx->tinfo.cpu = cpu; | 143 | irqctx->tinfo.cpu = cpu; |
144 | irqctx->tinfo.addr_limit = MAKE_MM_SEG(0); | 144 | irqctx->tinfo.addr_limit = MAKE_MM_SEG(0); |
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index 8215458f6af5..e8173154800d 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c | |||
@@ -76,10 +76,9 @@ void free_thread_xstate(struct task_struct *tsk) | |||
76 | fpu_free(&tsk->thread.fpu); | 76 | fpu_free(&tsk->thread.fpu); |
77 | } | 77 | } |
78 | 78 | ||
79 | void free_thread_info(struct thread_info *ti) | 79 | void arch_release_task_struct(struct task_struct *tsk) |
80 | { | 80 | { |
81 | free_thread_xstate(ti->task); | 81 | free_thread_xstate(tsk); |
82 | free_pages((unsigned long)ti, THREAD_ORDER); | ||
83 | } | 82 | } |
84 | 83 | ||
85 | void arch_task_cache_init(void) | 84 | void arch_task_cache_init(void) |