--- arch/x86/Kconfig | 12 ++++++++++++ arch/x86/Kconfig.debug | 11 ----------- arch/x86/kernel/irq_32.c | 8 ++++---- arch/x86/kernel/process_64.c | 2 +- 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_32.h | 6 +----- include/asm-x86/thread_info_64.h | 3 ++- 9 files changed, 23 insertions(+), 26 deletions(-) Index: linux-2.6/arch/x86/Kconfig =================================================================== --- linux-2.6.orig/arch/x86/Kconfig 2008-04-29 18:00:04.503707827 -0700 +++ linux-2.6/arch/x86/Kconfig 2008-04-29 18:06:11.911208217 -0700 @@ -1007,6 +1007,18 @@ config ARCH_MEMORY_PROBE def_bool X86_64 depends on MEMORY_HOTPLUG +config THREAD_ORDER + int "Kernel stack order" + default 1 + help + The kernel stack order determines the stack size. 8k (order 1) is + a setting that has been used for years. Stack allocations can use + virtual linear memory if the page allocator is not able to satisfy + request for linear physical memory for the stacks. + The use of kernel stack order of 0 on 32 bit enables IRQ stacks + that are used to compensate for reduced stack space. Order 0 stacks + will never require virtual mappings for the stack. + source "mm/Kconfig" config HIGHPTE Index: linux-2.6/arch/x86/Kconfig.debug =================================================================== --- linux-2.6.orig/arch/x86/Kconfig.debug 2008-04-29 18:00:04.513707515 -0700 +++ linux-2.6/arch/x86/Kconfig.debug 2008-04-29 18:06:11.921208139 -0700 @@ -115,17 +115,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/arch/x86/kernel/irq_32.c =================================================================== --- linux-2.6.orig/arch/x86/kernel/irq_32.c 2008-04-29 18:00:04.523708833 -0700 +++ linux-2.6/arch/x86/kernel/irq_32.c 2008-04-29 18:06:11.951206173 -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/include/asm-x86/irq_32.h =================================================================== --- linux-2.6.orig/include/asm-x86/irq_32.h 2008-04-29 18:00:04.533707403 -0700 +++ linux-2.6/include/asm-x86/irq_32.h 2008-04-29 18:06:11.971206130 -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/include/asm-x86/module.h =================================================================== --- linux-2.6.orig/include/asm-x86/module.h 2008-04-29 18:00:04.533707403 -0700 +++ linux-2.6/include/asm-x86/module.h 2008-04-29 18:06:12.001206306 -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/include/asm-x86/page_64.h =================================================================== --- linux-2.6.orig/include/asm-x86/page_64.h 2008-04-29 18:00:04.543707741 -0700 +++ linux-2.6/include/asm-x86/page_64.h 2008-04-29 18:06:12.023706373 -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 Index: linux-2.6/include/asm-x86/thread_info_32.h =================================================================== --- linux-2.6.orig/include/asm-x86/thread_info_32.h 2008-04-29 18:06:11.871209648 -0700 +++ linux-2.6/include/asm-x86/thread_info_32.h 2008-04-29 18:06:12.043708589 -0700 @@ -52,11 +52,7 @@ struct thread_info { #endif #define PREEMPT_ACTIVE 0x10000000 -#ifdef CONFIG_4KSTACKS -#define THREAD_SIZE (4096) -#else -#define THREAD_SIZE (8192) -#endif +#define THREAD_SIZE (PAGE_SIZE << CONFIG_STACK_ORDER2) #define STACK_WARN (THREAD_SIZE/8) /* Index: linux-2.6/include/asm-x86/thread_info_64.h =================================================================== --- linux-2.6.orig/include/asm-x86/thread_info_64.h 2008-04-29 18:06:11.871209648 -0700 +++ linux-2.6/include/asm-x86/thread_info_64.h 2008-04-29 18:06:12.061206119 -0700 @@ -83,7 +83,8 @@ static inline struct thread_info *stack_ #endif #define alloc_thread_info(tsk) \ - ((struct thread_info *)__alloc_vcompound(THREAD_FLAGS, THREAD_ORDER)) + ((struct thread_info *)__alloc_vcompound(THREAD_FLAGS, \ + CONFIG_THREAD_ORDER)) #else /* !__ASSEMBLY__ */ Index: linux-2.6/arch/x86/kernel/process_64.c =================================================================== --- linux-2.6.orig/arch/x86/kernel/process_64.c 2008-04-27 16:52:15.299899831 -0700 +++ linux-2.6/arch/x86/kernel/process_64.c 2008-04-29 18:51:10.893707716 -0700 @@ -855,7 +855,7 @@ long sys_arch_prctl(int code, unsigned l unsigned long arch_align_stack(unsigned long sp) { if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space) - sp -= get_random_int() % 8192; + sp -= get_random_int() % THREAD_SIZE; return sp & ~0xf; }