summary refs log tree commit diff
path: root/include/asm-arm/thread_info.h
diff options
context:
space:
mode:
authorPaul Gortmaker <paul.gortmaker@gmail.com>2006-11-02 16:41:18 +0100
committerRussell King <rmk+kernel@arm.linux.org.uk>2006-11-30 15:27:03 +0000
commit122214428a7bfab2c09b417f3acdb06222e81748 (patch)
treef453fa01829db292b1108e87a416c1acdfedcd70 /include/asm-arm/thread_info.h
parent9b531ce242159bd26e09b55d8fb4be3f4bf75e24 (diff)
downloadlinux-122214428a7bfab2c09b417f3acdb06222e81748.tar.gz
[ARM] 3911/2: Simplify alloc_thread_info on ARM
Remove ARM local cache of 4 struct thread_info.
Can cause oops under certain circumstances.

Russell indicated the original optimization was
required on older kernels to avoid thread starvation
on memory fragmentation, but may no longer be
required.  I've updated the patch to 19rc4 and
ensured no <config.h> dain-bramage slipped in this
time (sorry about that).

Original description follows:

I was given some test results which pointed to an
Oops in alloc_thread_info (happened 2x), and after
looking at the code, I see that ARM has its own
local cache of 4 struct thread_info. There wasn't
any clear (to me) synchronization between the
alloc_thread_info and the free_thread_info.

I looked over the other arch, and they all simply
allocate them on an as needed basis, so I simplified
the ARM to do the same, based on the other arch
(e.g. PPC) and the folks doing the testing have
indicated that this fixed the oops.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'include/asm-arm/thread_info.h')
-rw-r--r--include/asm-arm/thread_info.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/include/asm-arm/thread_info.h b/include/asm-arm/thread_info.h
index f28b236139ed..d9b8bddc8732 100644
--- a/include/asm-arm/thread_info.h
+++ b/include/asm-arm/thread_info.h
@@ -94,8 +94,18 @@ static inline struct thread_info *current_thread_info(void)
 	return (struct thread_info *)(sp & ~(THREAD_SIZE - 1));
 }
 
-extern struct thread_info *alloc_thread_info(struct task_struct *task);
-extern void free_thread_info(struct thread_info *);
+/* thread information allocation */
+#ifdef CONFIG_DEBUG_STACK_USAGE
+#define alloc_thread_info(tsk) \
+	((struct thread_info *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, \
+		THREAD_SIZE_ORDER))
+#else
+#define alloc_thread_info(tsk) \
+	((struct thread_info *)__get_free_pages(GFP_KERNEL, THREAD_SIZE_ORDER))
+#endif
+
+#define free_thread_info(info) \
+	free_pages((unsigned long)info, THREAD_SIZE_ORDER);
 
 #define thread_saved_pc(tsk)	\
 	((unsigned long)(pc_pointer(task_thread_info(tsk)->cpu_context.pc)))