From 81834e5c4295e53a2ca3322f3acfbd1437e0993e Mon Sep 17 00:00:00 2001 From: Christoph Lameter Date: Sat, 16 Feb 2008 20:20:54 -0800 Subject: vcompound: Fallbacks for order 1 stack allocations on x86 This allows fallback for order 1 stack allocations. In the fallback scenario the stacks will be virtually mapped. Note that stack fallbacks only work on platforms that have a hardware tlb lookup facility. A virtually mapped stack can cause tlb faults in critical kernel components. Processing a tlb fault may not be possible if the stack needs this tlb in order to process the fault. Signed-off-by: Christoph Lameter --- arch/x86/kernel/process.c | 3 ++- include/asm-x86/thread_info_32.h | 4 ++-- include/asm-x86/thread_info_64.h | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) Index: linux-2.6/include/asm-x86/thread_info_32.h =================================================================== --- linux-2.6.orig/include/asm-x86/thread_info_32.h 2008-04-28 18:43:14.029888939 -0700 +++ linux-2.6/include/asm-x86/thread_info_32.h 2008-04-29 17:30:34.953708258 -0700 @@ -96,10 +96,10 @@ static inline struct thread_info *curren /* thread information allocation */ #ifdef CONFIG_DEBUG_STACK_USAGE #define alloc_thread_info(tsk) ((struct thread_info *) \ - __get_free_pages(GFP_KERNEL | __GFP_ZERO, get_order(THREAD_SIZE))) + __alloc_vcompound(GFP_KERNEL | __GFP_ZERO, get_order(THREAD_SIZE))) #else #define alloc_thread_info(tsk) ((struct thread_info *) \ - __get_free_pages(GFP_KERNEL, get_order(THREAD_SIZE))) + __alloc_vcompound(GFP_KERNEL, get_order(THREAD_SIZE))) #endif #else /* !__ASSEMBLY__ */ Index: linux-2.6/include/asm-x86/thread_info_64.h =================================================================== --- linux-2.6.orig/include/asm-x86/thread_info_64.h 2008-04-28 18:43:14.039889785 -0700 +++ linux-2.6/include/asm-x86/thread_info_64.h 2008-04-29 17:31:05.171543820 -0700 @@ -83,7 +83,7 @@ static inline struct thread_info *stack_ #endif #define alloc_thread_info(tsk) \ - ((struct thread_info *)__get_free_pages(THREAD_FLAGS, THREAD_ORDER)) + ((struct thread_info *)__alloc_vcompound(THREAD_FLAGS, THREAD_ORDER)) #else /* !__ASSEMBLY__ */ Index: linux-2.6/arch/x86/kernel/process.c =================================================================== --- linux-2.6.orig/arch/x86/kernel/process.c 2008-04-29 17:31:22.903708482 -0700 +++ linux-2.6/arch/x86/kernel/process.c 2008-04-29 17:35:31.842262756 -0700 @@ -6,6 +6,7 @@ #include #include #include +#include struct kmem_cache *task_xstate_cachep; @@ -34,7 +35,7 @@ void free_thread_xstate(struct task_stru void free_thread_info(struct thread_info *ti) { free_thread_xstate(ti->task); - free_pages((unsigned long)ti, get_order(THREAD_SIZE)); + __free_vcompound(ti); } void arch_task_cache_init(void)