diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2012-05-05 11:05:45 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2012-05-08 08:08:45 -0400 |
commit | 96c951179736eb59c5f66de2ac85af9e7a6a8b15 (patch) | |
tree | 0ee038698189d943bf43d889e8eb8c769c4ee967 | |
parent | 3194f61de93d4d4fbc2f2ddb25aeded6f9cebaeb (diff) |
powerpc: Use common threadinfo allocator
The core now has a threadinfo allocator which uses a kmemcache when
THREAD_SIZE < PAGE_SIZE.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Link: http://lkml.kernel.org/r/20120505150142.059161130@linutronix.de
-rw-r--r-- | arch/powerpc/include/asm/thread_info.h | 13 | ||||
-rw-r--r-- | arch/powerpc/kernel/process.c | 31 |
2 files changed, 0 insertions, 44 deletions
diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h index 4a741c7efd02..1a1bb00f061a 100644 --- a/arch/powerpc/include/asm/thread_info.h +++ b/arch/powerpc/include/asm/thread_info.h | |||
@@ -62,21 +62,8 @@ struct thread_info { | |||
62 | #define init_thread_info (init_thread_union.thread_info) | 62 | #define init_thread_info (init_thread_union.thread_info) |
63 | #define init_stack (init_thread_union.stack) | 63 | #define init_stack (init_thread_union.stack) |
64 | 64 | ||
65 | /* thread information allocation */ | ||
66 | |||
67 | #if THREAD_SHIFT >= PAGE_SHIFT | ||
68 | |||
69 | #define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT) | 65 | #define THREAD_SIZE_ORDER (THREAD_SHIFT - PAGE_SHIFT) |
70 | 66 | ||
71 | #else /* THREAD_SHIFT < PAGE_SHIFT */ | ||
72 | |||
73 | #define __HAVE_ARCH_THREAD_INFO_ALLOCATOR | ||
74 | |||
75 | extern struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node); | ||
76 | extern void free_thread_info(struct thread_info *ti); | ||
77 | |||
78 | #endif /* THREAD_SHIFT < PAGE_SHIFT */ | ||
79 | |||
80 | /* how to get the thread information struct from C */ | 67 | /* how to get the thread information struct from C */ |
81 | static inline struct thread_info *current_thread_info(void) | 68 | static inline struct thread_info *current_thread_info(void) |
82 | { | 69 | { |
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 4937c9690090..aa05935b6947 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c | |||
@@ -1252,37 +1252,6 @@ void __ppc64_runlatch_off(void) | |||
1252 | } | 1252 | } |
1253 | #endif /* CONFIG_PPC64 */ | 1253 | #endif /* CONFIG_PPC64 */ |
1254 | 1254 | ||
1255 | #if THREAD_SHIFT < PAGE_SHIFT | ||
1256 | |||
1257 | static struct kmem_cache *thread_info_cache; | ||
1258 | |||
1259 | struct thread_info *alloc_thread_info_node(struct task_struct *tsk, int node) | ||
1260 | { | ||
1261 | struct thread_info *ti; | ||
1262 | |||
1263 | ti = kmem_cache_alloc_node(thread_info_cache, GFP_KERNEL, node); | ||
1264 | if (unlikely(ti == NULL)) | ||
1265 | return NULL; | ||
1266 | #ifdef CONFIG_DEBUG_STACK_USAGE | ||
1267 | memset(ti, 0, THREAD_SIZE); | ||
1268 | #endif | ||
1269 | return ti; | ||
1270 | } | ||
1271 | |||
1272 | void free_thread_info(struct thread_info *ti) | ||
1273 | { | ||
1274 | kmem_cache_free(thread_info_cache, ti); | ||
1275 | } | ||
1276 | |||
1277 | void thread_info_cache_init(void) | ||
1278 | { | ||
1279 | thread_info_cache = kmem_cache_create("thread_info", THREAD_SIZE, | ||
1280 | THREAD_SIZE, 0, NULL); | ||
1281 | BUG_ON(thread_info_cache == NULL); | ||
1282 | } | ||
1283 | |||
1284 | #endif /* THREAD_SHIFT < PAGE_SHIFT */ | ||
1285 | |||
1286 | unsigned long arch_align_stack(unsigned long sp) | 1255 | unsigned long arch_align_stack(unsigned long sp) |
1287 | { | 1256 | { |
1288 | if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space) | 1257 | if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space) |