--- arch/x86/Kconfig | 9 ++++++ arch/x86/Kconfig.debug | 11 ------- arch/x86/kernel/irq_32.c | 8 ++--- include/asm-x86/irq_32.h | 2 - include/asm-x86/module.h | 2 - include/asm-x86/page_64.h | 3 -- include/asm-x86/thread_info.h | 57 ++++++++++++++++++++++++++++++++++++++ include/asm-x86/thread_info_32.h | 58 --------------------------------------- include/asm-x86/thread_info_64.h | 53 ----------------------------------- 9 files changed, 74 insertions(+), 129 deletions(-) Index: linux-2.6.25-mm1/include/asm-x86/thread_info.h =================================================================== --- linux-2.6.25-mm1.orig/include/asm-x86/thread_info.h 2008-04-25 23:49:07.571139717 -0700 +++ linux-2.6.25-mm1/include/asm-x86/thread_info.h 2008-04-26 18:58:50.193638660 -0700 @@ -1,5 +1,62 @@ +/* + * Copyright (C) 2002 David Howells (dhowells@redhat.com) + * - Incorporating suggestions made by Linus Torvalds and Dave Miller + */ + +#ifndef _ASM_THREAD_INFO_H +#define _ASM_THREAD_INFO_H + +#ifdef __KERNEL__ + +#include +#include + +/* thread information allocation */ +#ifdef CONFIG_DEBUG_STACK_USAGE +#define THREAD_FLAGS (GFP_KERNEL | __GFP_ZERO) +#else +#define THREAD_FLAGS GFP_KERNEL +#endif + +#define alloc_thread_info(tsk) \ + ((struct thread_info *)__alloc_vcompound(THREAD_FLAGS, \ + CONFIG_THREAD_ORDER)) + +#define free_thread_info(ti) __free_vcompound(ti) + #ifdef CONFIG_X86_32 # include "thread_info_32.h" #else # include "thread_info_64.h" #endif + +/* + * Thread-synchronous status. + * + * This is different from the flags in that nobody else + * ever touches our thread-synchronous status, so we don't + * have to worry about atomic accesses. + */ +#define TS_USEDFPU 0x0001 /* FPU was used by this task + this quantum (SMP) */ +#define TS_POLLING 0x0002 /* True if in idle loop + and not sleeping */ + +#define TS_RESTORE_SIGMASK 0x0004 /* restore signal mask in do_signal() */ + +#define TS_COMPAT 0x0008 /* 32bit syscall active */ + +#define tsk_is_polling(t) (task_thread_info(t)->status & TS_POLLING) + +#ifndef __ASSEMBLY__ +#define HAVE_SET_RESTORE_SIGMASK 1 +static inline void set_restore_sigmask(void) +{ + struct thread_info *ti = current_thread_info(); + ti->status |= TS_RESTORE_SIGMASK; + set_bit(TIF_SIGPENDING, &ti->flags); +} + +#endif /* __KERNEL__ */ + +#endif /* _ASM_THREAD_INFO_H */ Index: linux-2.6.25-mm1/include/asm-x86/thread_info_32.h =================================================================== --- linux-2.6.25-mm1.orig/include/asm-x86/thread_info_32.h 2008-04-25 23:46:50.822389737 -0700 +++ linux-2.6.25-mm1/include/asm-x86/thread_info_32.h 2008-04-26 00:22:13.805416139 -0700 @@ -1,16 +1,4 @@ -/* thread_info.h: i386 low-level thread information - * - * Copyright (C) 2002 David Howells (dhowells@redhat.com) - * - Incorporating suggestions made by Linus Torvalds and Dave Miller - */ - -#ifndef _ASM_THREAD_INFO_H -#define _ASM_THREAD_INFO_H - -#ifdef __KERNEL__ - #include -#include #ifndef __ASSEMBLY__ #include @@ -52,13 +40,7 @@ struct thread_info { #endif #define PREEMPT_ACTIVE 0x10000000 -#ifdef CONFIG_4KSTACKS -#define THREAD_SIZE (4096) -#else -#define THREAD_SIZE (8192) -#endif - -#define STACK_WARN (THREAD_SIZE/8) +#define STACK_WARN ((PAGE_SIZE << CONFIG_THREAD_ORDER)/8) /* * macros/functions for gaining access to the thread information structure * @@ -93,17 +75,6 @@ static inline struct thread_info *curren (current_stack_pointer & ~(THREAD_SIZE - 1)); } -/* thread information allocation */ -#ifdef CONFIG_DEBUG_STACK_USAGE -#define alloc_thread_info(tsk) ((struct thread_info *) \ - __alloc_vcompound(GFP_KERNEL | __GFP_ZERO, get_order(THREAD_SIZE))) -#else -#define alloc_thread_info(tsk) ((struct thread_info *) \ - __alloc_vcompound(GFP_KERNEL, get_order(THREAD_SIZE))) -#endif - -#define free_thread_info(info) __free_vcompound(info) - #else /* !__ASSEMBLY__ */ /* how to get the thread information struct from ASM */ @@ -177,31 +148,4 @@ static inline struct thread_info *curren #define _TIF_WORK_CTXSW_NEXT (_TIF_WORK_CTXSW | _TIF_DEBUG) -/* - * Thread-synchronous status. - * - * This is different from the flags in that nobody else - * ever touches our thread-synchronous status, so we don't - * have to worry about atomic accesses. - */ -#define TS_USEDFPU 0x0001 /* FPU was used by this task - this quantum (SMP) */ -#define TS_POLLING 0x0002 /* True if in idle loop - and not sleeping */ -#define TS_RESTORE_SIGMASK 0x0004 /* restore signal mask in do_signal() */ - -#define tsk_is_polling(t) (task_thread_info(t)->status & TS_POLLING) - -#ifndef __ASSEMBLY__ -#define HAVE_SET_RESTORE_SIGMASK 1 -static inline void set_restore_sigmask(void) -{ - struct thread_info *ti = current_thread_info(); - ti->status |= TS_RESTORE_SIGMASK; - set_bit(TIF_SIGPENDING, &ti->flags); -} -#endif /* !__ASSEMBLY__ */ - -#endif /* __KERNEL__ */ -#endif /* _ASM_THREAD_INFO_H */ Index: linux-2.6.25-mm1/include/asm-x86/thread_info_64.h =================================================================== --- linux-2.6.25-mm1.orig/include/asm-x86/thread_info_64.h 2008-04-25 23:47:38.119889950 -0700 +++ linux-2.6.25-mm1/include/asm-x86/thread_info_64.h 2008-04-26 00:30:28.881377843 -0700 @@ -1,16 +1,3 @@ -/* thread_info.h: x86_64 low-level thread information - * - * Copyright (C) 2002 David Howells (dhowells@redhat.com) - * - Incorporating suggestions made by Linus Torvalds and Dave Miller - */ - -#ifndef _ASM_THREAD_INFO_H -#define _ASM_THREAD_INFO_H - -#ifdef __KERNEL__ - -#include -#include #include /* @@ -75,18 +62,6 @@ static inline struct thread_info *stack_ return ti; } -/* thread information allocation */ -#ifdef CONFIG_DEBUG_STACK_USAGE -#define THREAD_FLAGS (GFP_KERNEL | __GFP_ZERO) -#else -#define THREAD_FLAGS GFP_KERNEL -#endif - -#define alloc_thread_info(tsk) \ - ((struct thread_info *)__alloc_vcompound(THREAD_FLAGS, THREAD_ORDER)) - -#define free_thread_info(ti) __free_vcompound(ti) - #else /* !__ASSEMBLY__ */ /* how to get the thread information struct from ASM */ @@ -164,32 +139,4 @@ static inline struct thread_info *stack_ #define PREEMPT_ACTIVE 0x10000000 -/* - * Thread-synchronous status. - * - * This is different from the flags in that nobody else - * ever touches our thread-synchronous status, so we don't - * have to worry about atomic accesses. - */ -#define TS_USEDFPU 0x0001 /* FPU was used by this task - this quantum (SMP) */ -#define TS_COMPAT 0x0002 /* 32bit syscall active */ -#define TS_POLLING 0x0004 /* true if in idle loop - and not sleeping */ -#define TS_RESTORE_SIGMASK 0x0008 /* restore signal mask in do_signal() */ - -#define tsk_is_polling(t) (task_thread_info(t)->status & TS_POLLING) - -#ifndef __ASSEMBLY__ -#define HAVE_SET_RESTORE_SIGMASK 1 -static inline void set_restore_sigmask(void) -{ - struct thread_info *ti = current_thread_info(); - ti->status |= TS_RESTORE_SIGMASK; - set_bit(TIF_SIGPENDING, &ti->flags); -} -#endif /* !__ASSEMBLY__ */ - -#endif /* __KERNEL__ */ -#endif /* _ASM_THREAD_INFO_H */ Index: linux-2.6.25-mm1/arch/x86/Kconfig =================================================================== --- linux-2.6.25-mm1.orig/arch/x86/Kconfig 2008-04-26 00:00:08.243640249 -0700 +++ linux-2.6.25-mm1/arch/x86/Kconfig 2008-04-26 00:56:33.909898152 -0700 @@ -977,6 +977,15 @@ config ARCH_MEMORY_PROBE def_bool X86_64 depends on MEMORY_HOTPLUG +config THREAD_ORDER + int "Kernel Stack Order" + default 1 + help + The stack order determines the stack size. 8k (order 1) is the + typical default. Stack allocations can use virtualized mappings. + So there is no requirement that large contiguous memory is + allocated. + source "mm/Kconfig" config HIGHPTE Index: linux-2.6.25-mm1/arch/x86/Kconfig.debug =================================================================== --- linux-2.6.25-mm1.orig/arch/x86/Kconfig.debug 2008-04-26 00:08:27.081139717 -0700 +++ linux-2.6.25-mm1/arch/x86/Kconfig.debug 2008-04-26 00:11:54.100153802 -0700 @@ -117,17 +117,6 @@ config DEBUG_NX_TEST and the software setup of this feature. If in doubt, say "N" -config 4KSTACKS - bool "Use 4Kb for kernel stacks instead of 8Kb" - depends on X86_32 - default y - help - If you say Y here the kernel will use a 4Kb stacksize for the - kernel stack attached to each process/thread. This facilitates - running more threads on a system and also reduces the pressure - on the VM subsystem for higher order allocations. This option - will also use IRQ stacks to compensate for the reduced stackspace. - config X86_FIND_SMP_CONFIG def_bool y depends on X86_LOCAL_APIC || X86_VOYAGER Index: linux-2.6.25-mm1/arch/x86/kernel/irq_32.c =================================================================== --- linux-2.6.25-mm1.orig/arch/x86/kernel/irq_32.c 2008-04-26 00:15:31.793639149 -0700 +++ linux-2.6.25-mm1/arch/x86/kernel/irq_32.c 2008-04-26 00:17:08.663649509 -0700 @@ -48,7 +48,7 @@ void ack_bad_irq(unsigned int irq) #endif } -#ifdef CONFIG_4KSTACKS +#if CONFIG_STACK_ORDER == 0 /* * per-CPU IRQ handling contexts (thread information and stack) */ @@ -72,7 +72,7 @@ unsigned int do_IRQ(struct pt_regs *regs /* high bit used in ret_from_ code */ int irq = ~regs->orig_ax; struct irq_desc *desc = irq_desc + irq; -#ifdef CONFIG_4KSTACKS +#if CONFIG_STACK_ORDER == 0 union irq_ctx *curctx, *irqctx; u32 *isp; #endif @@ -100,7 +100,7 @@ unsigned int do_IRQ(struct pt_regs *regs } #endif -#ifdef CONFIG_4KSTACKS +#if CONFIG_STACK_ORDER == 0 curctx = (union irq_ctx *) current_thread_info(); irqctx = hardirq_ctx[smp_processor_id()]; @@ -145,7 +145,7 @@ unsigned int do_IRQ(struct pt_regs *regs return 1; } -#ifdef CONFIG_4KSTACKS +#if CONFIG_STACK_ORDER == 0 static char softirq_stack[NR_CPUS * THREAD_SIZE] __attribute__((__section__(".bss.page_aligned"))); Index: linux-2.6.25-mm1/include/asm-x86/irq_32.h =================================================================== --- linux-2.6.25-mm1.orig/include/asm-x86/irq_32.h 2008-04-26 00:12:38.553639815 -0700 +++ linux-2.6.25-mm1/include/asm-x86/irq_32.h 2008-04-26 00:12:59.940410928 -0700 @@ -24,7 +24,7 @@ static inline int irq_canonicalize(int i # define ARCH_HAS_NMI_WATCHDOG /* See include/linux/nmi.h */ #endif -#ifdef CONFIG_4KSTACKS +#if CONFIG_STACK_ORDER == 0 extern void irq_ctx_init(int cpu); extern void irq_ctx_exit(int cpu); # define __ARCH_HAS_DO_SOFTIRQ Index: linux-2.6.25-mm1/include/asm-x86/module.h =================================================================== --- linux-2.6.25-mm1.orig/include/asm-x86/module.h 2008-04-26 00:13:06.913639135 -0700 +++ linux-2.6.25-mm1/include/asm-x86/module.h 2008-04-26 00:13:56.179895774 -0700 @@ -71,7 +71,7 @@ struct mod_arch_specific {}; #endif #ifdef CONFIG_X86_32 -# ifdef CONFIG_4KSTACKS +# if CONFIG_STACK_ORDER == 0 # define MODULE_STACKSIZE "4KSTACKS " # else # define MODULE_STACKSIZE "" Index: linux-2.6.25-mm1/include/asm-x86/page_64.h =================================================================== --- linux-2.6.25-mm1.orig/include/asm-x86/page_64.h 2008-04-26 00:00:56.793639940 -0700 +++ linux-2.6.25-mm1/include/asm-x86/page_64.h 2008-04-26 00:02:42.463811703 -0700 @@ -3,8 +3,7 @@ #define PAGETABLE_LEVELS 4 -#define THREAD_ORDER 1 -#define THREAD_SIZE (PAGE_SIZE << THREAD_ORDER) +#define THREAD_SIZE (PAGE_SIZE << CONFIG_THREAD_ORDER) #define CURRENT_MASK (~(THREAD_SIZE - 1)) #define EXCEPTION_STACK_ORDER 0