Whamcloud - gitweb
b=5445
authorphil <phil>
Mon, 10 Jan 2005 21:51:53 +0000 (21:51 +0000)
committerphil <phil>
Mon, 10 Jan 2005 21:51:53 +0000 (21:51 +0000)
Fix the x86-64 large-stack RHEL3 patch.  The old patch would allocate 1 page
in alloc_task_struct, then free THREAD_ORDER pages in free_task_struct.

lustre/kernel_patches/patches/configurable-x86-stack-2.4.21-chaos.patch

index 3fe5f74..271ee19 100644 (file)
@@ -1,7 +1,285 @@
-Index: linux-2.4.21/arch/i386/kernel/entry.S
+Index: linux-2.4.21-27.EL/include/asm-i386/hw_irq.h
 ===================================================================
---- linux-2.4.21.orig/arch/i386/kernel/entry.S 2004-09-11 10:16:39.000000000 -0400
-+++ linux-2.4.21/arch/i386/kernel/entry.S      2004-12-20 17:47:25.000000000 -0500
+--- linux-2.4.21-27.EL.orig/include/asm-i386/hw_irq.h  2004-12-21 13:51:09.000000000 -0500
++++ linux-2.4.21-27.EL/include/asm-i386/hw_irq.h       2005-01-07 10:55:45.367690072 -0500
+@@ -135,21 +135,17 @@
+       "                                                               \
+       /* load the real stack - keep the offset */                     \
+                                                                       \
+-      movl $-8192, %ebx;                                              \
++      movl $- " STR(THREAD_SIZE) ", %ebx;                             \
+       andl %esp, %ebx;                                                \
+       movl 36(%ebx), %edx;                                            \
+       movl %esp, %ebx;                                                \
+-      andl $0x1fff, %ebx;                                             \
++      andl $( " STR(THREAD_SIZE) "-1), %ebx;                          \
+       orl %ebx, %edx;                                                 \
+       movl %edx, %esp;"
+ #define IRQ_NAME2(nr) nr##_interrupt(void)
+ #define IRQ_NAME(nr) IRQ_NAME2(IRQ##nr)
+-#define GET_CURRENT \
+-      "movl %esp, %ebx\n\t" \
+-      "andl $-8192, %ebx\n\t"
+-
+ /*
+  *    SMP has a few special interrupts for IPI messages
+  */
+Index: linux-2.4.21-27.EL/include/asm-i386/processor.h
+===================================================================
+--- linux-2.4.21-27.EL.orig/include/asm-i386/processor.h       2004-12-21 13:51:31.000000000 -0500
++++ linux-2.4.21-27.EL/include/asm-i386/processor.h    2005-01-07 10:55:45.376688704 -0500
+@@ -14,6 +14,7 @@
+ #include <asm/types.h>
+ #include <asm/sigcontext.h>
+ #include <asm/cpufeature.h>
++#include <asm/current.h>
+ #include <linux/cache.h>
+ #include <linux/config.h>
+ #include <linux/threads.h>
+@@ -490,10 +491,6 @@
+ #define KSTK_EIP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1019])
+ #define KSTK_ESP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1022])
+-#define THREAD_SIZE (2*PAGE_SIZE)
+-#define __alloc_task_struct() ((struct task_struct *) __get_free_pages(GFP_KERNEL,1))
+-#define __free_task_struct(p) do { BUG_ON((p)->state < TASK_ZOMBIE); free_pages((unsigned long) (p), 1); } while (0)
+-
+ #define init_task     (init_task_union.task)
+ #define init_stack    (init_task_union.stack)
+Index: linux-2.4.21-27.EL/include/asm-i386/current.h
+===================================================================
+--- linux-2.4.21-27.EL.orig/include/asm-i386/current.h 1998-08-14 19:35:22.000000000 -0400
++++ linux-2.4.21-27.EL/include/asm-i386/current.h      2005-01-07 10:55:45.356691744 -0500
+@@ -1,15 +1,64 @@
+ #ifndef _I386_CURRENT_H
+ #define _I386_CURRENT_H
++#include <asm/page.h>
++
++/*
++ * Configurable page sizes on i386, mainly for debugging purposes.
++ * (c) Balbir Singh
++ */
++
++/* enumerate the values, include/asm-i386/hw_irq.h in particular needs this */
++#if (PAGE_SIZE != 4096)
++#error PAGE_SIZE != 4096 unsupported
++#endif
++
++#if (CONFIG_STACK_SIZE_SHIFT == 0)
++#define THREAD_SIZE   4096
++#elif (CONFIG_STACK_SIZE_SHIFT == 1)
++#define THREAD_SIZE   8192
++#elif (CONFIG_STACK_SIZE_SHIFT == 2)
++#define THREAD_SIZE   16384
++#elif (CONFIG_STACK_SIZE_SHIFT == 3)
++#define THREAD_SIZE   32768
++#elif (CONFIG_STACK_SIZE_SHIFT == 4)
++#define THREAD_SIZE   65536
++#else
++#error CONFIG_STACK_SIZE_SHIFT > 4 unsupported
++#endif
++
++#if (CONFIG_STACK_SIZE_SHIFT != 1) && defined(CONFIG_X86_4G)
++#error Large stacks with 4G/4G split unsupported
++#endif
++
++#ifdef __ASSEMBLY__
++
++#define GET_CURRENT(reg) \
++      movl $-THREAD_SIZE, reg; \
++      andl %esp, reg
++
++#else /* __ASSEMBLY__ */
++
++#define __alloc_task_struct() \
++  ((struct task_struct *) __get_free_pages(GFP_KERNEL, CONFIG_STACK_SIZE_SHIFT))
++
++#define __free_task_struct(p) do { \
++  BUG_ON((p)->state < TASK_ZOMBIE); \
++  free_pages((unsigned long) (p), CONFIG_STACK_SIZE_SHIFT); \
++} while(0)
++
++#define INIT_TASK_SIZE THREAD_SIZE
+ struct task_struct;
+ static inline struct task_struct * get_current(void)
+ {
+       struct task_struct *current;
+-      __asm__("andl %%esp,%0; ":"=r" (current) : "0" (~8191UL));
++      __asm__("andl %%esp,%0; ":"=r" (current) : "0" (~(THREAD_SIZE - 1)));
+       return current;
+  }
+  
+ #define current get_current()
++#endif /* __ASSEMBLY__ */
++
+ #endif /* !(_I386_CURRENT_H) */
+Index: linux-2.4.21-27.EL/include/asm-x86_64/processor.h
+===================================================================
+--- linux-2.4.21-27.EL.orig/include/asm-x86_64/processor.h     2004-12-21 13:51:31.000000000 -0500
++++ linux-2.4.21-27.EL/include/asm-x86_64/processor.h  2005-01-07 10:58:24.167548824 -0500
+@@ -407,8 +407,8 @@
+ /* Note: most of the infrastructure to separate stack and task_struct
+    are already there. When you run out of stack try this first. */
+-#define __alloc_task_struct() ((struct task_struct *) __get_free_pages(GFP_KERNEL,1))
+-#define  __free_task_struct(p) free_pages((unsigned long) (p), 1)
++#define __alloc_task_struct() ((struct task_struct *) __get_free_pages(GFP_KERNEL, THREAD_ORDER))
++#define  __free_task_struct(p) free_pages((unsigned long) (p), THREAD_ORDER)
+   
+ #define init_task     (init_task_union.task)
+ #define init_stack    (init_task_union.stack)
+Index: linux-2.4.21-27.EL/include/asm-x86_64/page.h
+===================================================================
+--- linux-2.4.21-27.EL.orig/include/asm-x86_64/page.h  2004-12-21 13:51:10.000000000 -0500
++++ linux-2.4.21-27.EL/include/asm-x86_64/page.h       2005-01-07 10:55:45.404684448 -0500
+@@ -27,8 +27,8 @@
+ /* We still hope 8K is enough, but ... */
+ /* Currently it is actually ~6k. This would change when task_struct moves into
+    an own slab. */
+-#define THREAD_ORDER    1
+-#define THREAD_SIZE    (2*PAGE_SIZE)
++#define THREAD_ORDER   CONFIG_STACK_SIZE_SHIFT 
++#define THREAD_SIZE    ((1 << CONFIG_STACK_SIZE_SHIFT) * PAGE_SIZE)
+ #define INIT_TASK_SIZE THREAD_SIZE
+ #define CURRENT_MASK (~(THREAD_SIZE-1))
+Index: linux-2.4.21-27.EL/include/asm-x86_64/current.h
+===================================================================
+--- linux-2.4.21-27.EL.orig/include/asm-x86_64/current.h       2002-11-28 18:53:15.000000000 -0500
++++ linux-2.4.21-27.EL/include/asm-x86_64/current.h    2005-01-07 10:55:45.394685968 -0500
+@@ -5,6 +5,7 @@
+ struct task_struct;
+ #include <asm/pda.h>
++#include <asm/page.h>
+ static inline struct task_struct *get_current(void) 
+ { 
+Index: linux-2.4.21-27.EL/arch/x86_64/config.in
+===================================================================
+--- linux-2.4.21-27.EL.orig/arch/x86_64/config.in      2004-12-21 13:51:30.000000000 -0500
++++ linux-2.4.21-27.EL/arch/x86_64/config.in   2005-01-07 10:55:45.324696608 -0500
+@@ -90,6 +90,28 @@
+    define_bool CONFIG_NUMA y
+ fi
++choice 'Bigger Stack Size Support' \
++     "off    CONFIG_NOBIGSTACK \
++      16KB   CONFIG_STACK_SIZE_16KB \
++      32KB   CONFIG_STACK_SIZE_32KB \
++      64KB   CONFIG_STACK_SIZE_64KB" off
++
++if [ "$CONFIG_NOBIGSTACK" = "y" ]; then
++   define_int CONFIG_STACK_SIZE_SHIFT 1
++else
++  if [ "$CONFIG_STACK_SIZE_16KB" = "y" ]; then
++     define_int CONFIG_STACK_SIZE_SHIFT 2
++  else
++    if [ "$CONFIG_STACK_SIZE_32KB" = "y" ]; then
++      define_int CONFIG_STACK_SIZE_SHIFT 3
++   else
++      if [ "$CONFIG_STACK_SIZE_64KB" = "y" ]; then
++        define_int CONFIG_STACK_SIZE_SHIFT 4
++      fi
++    fi
++  fi
++fi
++ 
+ endmenu
+ mainmenu_option next_comment
+Index: linux-2.4.21-27.EL/arch/x86_64/kernel/smpboot.c
+===================================================================
+--- linux-2.4.21-27.EL.orig/arch/x86_64/kernel/smpboot.c       2004-12-21 13:51:01.000000000 -0500
++++ linux-2.4.21-27.EL/arch/x86_64/kernel/smpboot.c    2005-01-07 10:55:45.325696456 -0500
+@@ -753,7 +753,7 @@
+                       Dprintk("CPU has booted.\n");
+               } else {
+                       boot_status = 1;
+-                      if (*((volatile unsigned char *)phys_to_virt(8192))
++                      if (*((volatile unsigned char *)phys_to_virt(THREAD_SIZE))
+                                       == 0xA5)
+                               /* trampoline started but...? */
+                               printk("Stuck ??\n");
+@@ -771,7 +771,7 @@
+       }
+       /* mark "stuck" area as not stuck */
+-      *((volatile unsigned int *)phys_to_virt(8192)) = 0;
++      *((volatile unsigned int *)phys_to_virt(THREAD_SIZE)) = 0;
+       
+       return cpu; 
+ }
+Index: linux-2.4.21-27.EL/arch/x86_64/kernel/traps.c
+===================================================================
+--- linux-2.4.21-27.EL.orig/arch/x86_64/kernel/traps.c 2004-12-21 13:51:15.000000000 -0500
++++ linux-2.4.21-27.EL/arch/x86_64/kernel/traps.c      2005-01-07 10:55:45.326696304 -0500
+@@ -240,7 +240,7 @@
+       unsigned long rsp = tsk->thread.rsp;
+       /* User space on another CPU? */
+-      if ((rsp ^ (unsigned long)tsk) & (PAGE_MASK<<1))
++      if ((rsp ^ (unsigned long)tsk) & ~(THREAD_SIZE - 1))
+               return;
+       show_trace((unsigned long *)rsp);
+ }
+Index: linux-2.4.21-27.EL/arch/x86_64/vmlinux.lds
+===================================================================
+--- linux-2.4.21-27.EL.orig/arch/x86_64/vmlinux.lds    2003-06-13 10:51:32.000000000 -0400
++++ linux-2.4.21-27.EL/arch/x86_64/vmlinux.lds 2005-01-07 10:55:45.327696152 -0500
+@@ -72,7 +72,8 @@
+   .vsyscall_1 ADDR(.vsyscall_0) + 1024: AT (LOADADDR(.vsyscall_0) + 1024) { *(.vsyscall_1) }
+   . = LOADADDR(.vsyscall_0) + 4096;
+-  . = ALIGN(8192);            /* init_task */
++/* chose the biggest of the possible stack sizes here? */
++  . = ALIGN(65536);           /* init_task */
+   .data.init_task : { *(.data.init_task) }
+   . = ALIGN(4096); 
+Index: linux-2.4.21-27.EL/arch/i386/config.in
+===================================================================
+--- linux-2.4.21-27.EL.orig/arch/i386/config.in        2004-12-21 13:51:31.000000000 -0500
++++ linux-2.4.21-27.EL/arch/i386/config.in     2005-01-07 10:55:45.324696608 -0500
+@@ -306,6 +306,28 @@
+    fi
+ fi
++choice 'Bigger Stack Size Support' \
++     "off    CONFIG_NOBIGSTACK \
++      16KB   CONFIG_STACK_SIZE_16KB \
++      32KB   CONFIG_STACK_SIZE_32KB \
++      64KB   CONFIG_STACK_SIZE_64KB" off
++
++if [ "$CONFIG_NOBIGSTACK" = "y" ]; then
++   define_int CONFIG_STACK_SIZE_SHIFT 1
++else
++  if [ "$CONFIG_STACK_SIZE_16KB" = "y" ]; then
++     define_int CONFIG_STACK_SIZE_SHIFT 2
++  else
++    if [ "$CONFIG_STACK_SIZE_32KB" = "y" ]; then
++      define_int CONFIG_STACK_SIZE_SHIFT 3
++    else
++      if [ "$CONFIG_STACK_SIZE_64KB" = "y" ]; then
++        define_int CONFIG_STACK_SIZE_SHIFT 4
++      fi
++    fi
++  fi
++fi
++
+ if [ "$CONFIG_SMP" = "y" -a "$CONFIG_X86_CMPXCHG" = "y" ]; then
+    define_bool CONFIG_HAVE_DEC_LOCK y
+ fi
+Index: linux-2.4.21-27.EL/arch/i386/kernel/entry.S
+===================================================================
+--- linux-2.4.21-27.EL.orig/arch/i386/kernel/entry.S   2004-12-21 13:51:31.000000000 -0500
++++ linux-2.4.21-27.EL/arch/i386/kernel/entry.S        2005-01-07 10:55:45.271704664 -0500
 @@ -46,6 +46,7 @@
  #include <asm/segment.h>
  #include <asm/page.h>
@@ -39,10 +317,31 @@ Index: linux-2.4.21/arch/i386/kernel/entry.S
        orl %ebx, %edx;                                 \
        movl %esp, %eax;                                \
        movl %edx, %esp;                                \
-Index: linux-2.4.21/arch/i386/kernel/smpboot.c
+Index: linux-2.4.21-27.EL/arch/i386/kernel/irq.c
 ===================================================================
---- linux-2.4.21.orig/arch/i386/kernel/smpboot.c       2004-09-11 10:16:17.000000000 -0400
-+++ linux-2.4.21/arch/i386/kernel/smpboot.c    2004-12-20 17:47:25.000000000 -0500
+--- linux-2.4.21-27.EL.orig/arch/i386/kernel/irq.c     2004-12-21 13:51:22.000000000 -0500
++++ linux-2.4.21-27.EL/arch/i386/kernel/irq.c  2005-01-07 10:55:45.307699192 -0500
+@@ -45,6 +45,7 @@
+ #include <asm/delay.h>
+ #include <asm/desc.h>
+ #include <asm/irq.h>
++#include <asm/current.h>
+@@ -585,7 +586,7 @@
+       long esp;
+       /* Debugging check for stack overflow: is there less than 1KB free? */
+-      __asm__ __volatile__("andl %%esp,%0" : "=r" (esp) : "0" (8191));
++      __asm__ __volatile__("andl %%esp,%0" : "=r" (esp) : "0" (THREAD_SIZE-1));
+       if (unlikely(esp < (sizeof(struct task_struct) + 1024))) {
+               extern void show_stack(unsigned long *);
+Index: linux-2.4.21-27.EL/arch/i386/kernel/smpboot.c
+===================================================================
+--- linux-2.4.21-27.EL.orig/arch/i386/kernel/smpboot.c 2004-12-21 13:51:01.000000000 -0500
++++ linux-2.4.21-27.EL/arch/i386/kernel/smpboot.c      2005-01-07 10:55:45.305699496 -0500
 @@ -814,7 +814,7 @@
  
        /* So we see what's up   */
@@ -70,10 +369,10 @@ Index: linux-2.4.21/arch/i386/kernel/smpboot.c
  
        if(clustered_apic_mode == CLUSTERED_APIC_NUMAQ) {
                printk("Restoring NMI vector\n");
-Index: linux-2.4.21/arch/i386/kernel/traps.c
+Index: linux-2.4.21-27.EL/arch/i386/kernel/traps.c
 ===================================================================
---- linux-2.4.21.orig/arch/i386/kernel/traps.c 2004-09-11 10:16:25.000000000 -0400
-+++ linux-2.4.21/arch/i386/kernel/traps.c      2004-12-20 17:47:25.000000000 -0500
+--- linux-2.4.21-27.EL.orig/arch/i386/kernel/traps.c   2004-12-21 13:51:15.000000000 -0500
++++ linux-2.4.21-27.EL/arch/i386/kernel/traps.c        2005-01-07 10:55:45.306699344 -0500
 @@ -180,7 +180,7 @@
        unsigned long esp = tsk->thread.esp;
  
@@ -83,52 +382,31 @@ Index: linux-2.4.21/arch/i386/kernel/traps.c
                return;
        show_trace((unsigned long *)esp);
  }
-Index: linux-2.4.21/arch/i386/kernel/head.S
+Index: linux-2.4.21-27.EL/arch/i386/kernel/head.S
 ===================================================================
---- linux-2.4.21.orig/arch/i386/kernel/head.S  2004-09-11 10:16:19.000000000 -0400
-+++ linux-2.4.21/arch/i386/kernel/head.S       2004-12-20 17:47:25.000000000 -0500
+--- linux-2.4.21-27.EL.orig/arch/i386/kernel/head.S    2004-12-21 13:51:07.000000000 -0500
++++ linux-2.4.21-27.EL/arch/i386/kernel/head.S 2005-01-07 10:55:45.307699192 -0500
 @@ -15,6 +15,7 @@
  #include <asm/page.h>
  #include <asm/pgtable.h>
  #include <asm/desc.h>
-+#include <asm/current.h>
- #define OLD_CL_MAGIC_ADDR     0x90020
- #define OLD_CL_MAGIC          0xA33F
-@@ -343,7 +344,7 @@
-       ret
- ENTRY(stack_start)
--      .long SYMBOL_NAME(init_task_union)+8192
-+      .long SYMBOL_NAME(init_task_union)+THREAD_SIZE
-       .long __KERNEL_DS
- /* This is the default interrupt "handler" :-) */
-Index: linux-2.4.21/arch/i386/kernel/irq.c
-===================================================================
---- linux-2.4.21.orig/arch/i386/kernel/irq.c   2004-09-11 10:16:30.000000000 -0400
-+++ linux-2.4.21/arch/i386/kernel/irq.c        2004-12-20 17:47:25.000000000 -0500
-@@ -45,6 +45,7 @@
- #include <asm/delay.h>
- #include <asm/desc.h>
- #include <asm/irq.h>
-+#include <asm/current.h>
++#include <asm/current.h>
  
-@@ -585,7 +586,7 @@
-       long esp;
+ #define OLD_CL_MAGIC_ADDR     0x90020
+ #define OLD_CL_MAGIC          0xA33F
+@@ -343,7 +344,7 @@
+       ret
  
-       /* Debugging check for stack overflow: is there less than 1KB free? */
--      __asm__ __volatile__("andl %%esp,%0" : "=r" (esp) : "0" (8191));
-+      __asm__ __volatile__("andl %%esp,%0" : "=r" (esp) : "0" (THREAD_SIZE-1));
-       if (unlikely(esp < (sizeof(struct task_struct) + 1024))) {
-               extern void show_stack(unsigned long *);
+ ENTRY(stack_start)
+-      .long SYMBOL_NAME(init_task_union)+8192
++      .long SYMBOL_NAME(init_task_union)+THREAD_SIZE
+       .long __KERNEL_DS
  
-Index: linux-2.4.21/arch/i386/lib/getuser.S
+ /* This is the default interrupt "handler" :-) */
+Index: linux-2.4.21-27.EL/arch/i386/lib/getuser.S
 ===================================================================
---- linux-2.4.21.orig/arch/i386/lib/getuser.S  1998-01-12 16:42:52.000000000 -0500
-+++ linux-2.4.21/arch/i386/lib/getuser.S       2004-12-20 17:47:25.000000000 -0500
+--- linux-2.4.21-27.EL.orig/arch/i386/lib/getuser.S    1998-01-12 16:42:52.000000000 -0500
++++ linux-2.4.21-27.EL/arch/i386/lib/getuser.S 2005-01-07 10:55:45.323696760 -0500
 @@ -21,6 +21,10 @@
   * as they get called from within inline assembly.
   */
@@ -167,43 +445,10 @@ Index: linux-2.4.21/arch/i386/lib/getuser.S
        cmpl addr_limit(%edx),%eax
        jae bad_get_user
  3:    movl -3(%eax),%edx
-Index: linux-2.4.21/arch/i386/config.in
-===================================================================
---- linux-2.4.21.orig/arch/i386/config.in      2004-09-11 10:16:39.000000000 -0400
-+++ linux-2.4.21/arch/i386/config.in   2004-12-20 17:47:25.000000000 -0500
-@@ -306,6 +306,28 @@
-    fi
- fi
-+choice 'Bigger Stack Size Support' \
-+     "off    CONFIG_NOBIGSTACK \
-+      16KB   CONFIG_STACK_SIZE_16KB \
-+      32KB   CONFIG_STACK_SIZE_32KB \
-+      64KB   CONFIG_STACK_SIZE_64KB" off
-+
-+if [ "$CONFIG_NOBIGSTACK" = "y" ]; then
-+   define_int CONFIG_STACK_SIZE_SHIFT 1
-+else
-+  if [ "$CONFIG_STACK_SIZE_16KB" = "y" ]; then
-+     define_int CONFIG_STACK_SIZE_SHIFT 2
-+  else
-+    if [ "$CONFIG_STACK_SIZE_32KB" = "y" ]; then
-+      define_int CONFIG_STACK_SIZE_SHIFT 3
-+    else
-+      if [ "$CONFIG_STACK_SIZE_64KB" = "y" ]; then
-+        define_int CONFIG_STACK_SIZE_SHIFT 4
-+      fi
-+    fi
-+  fi
-+fi
-+
- if [ "$CONFIG_SMP" = "y" -a "$CONFIG_X86_CMPXCHG" = "y" ]; then
-    define_bool CONFIG_HAVE_DEC_LOCK y
- fi
-Index: linux-2.4.21/arch/i386/vmlinux.lds.in
+Index: linux-2.4.21-27.EL/arch/i386/vmlinux.lds.in
 ===================================================================
---- linux-2.4.21.orig/arch/i386/vmlinux.lds.in 2004-09-11 10:16:19.000000000 -0400
-+++ linux-2.4.21/arch/i386/vmlinux.lds.in      2004-12-20 17:47:25.000000000 -0500
+--- linux-2.4.21-27.EL.orig/arch/i386/vmlinux.lds.in   2004-12-21 13:51:08.000000000 -0500
++++ linux-2.4.21-27.EL/arch/i386/vmlinux.lds.in        2005-01-07 10:55:45.324696608 -0500
 @@ -1,6 +1,7 @@
  
  #define __ASSEMBLY__
@@ -221,246 +466,3 @@ Index: linux-2.4.21/arch/i386/vmlinux.lds.in
    .data.init_task : { *(.data.init_task) }
  
    entry_tramp_start = .;
-Index: linux-2.4.21/arch/x86_64/config.in
-===================================================================
---- linux-2.4.21.orig/arch/x86_64/config.in    2004-09-11 10:16:35.000000000 -0400
-+++ linux-2.4.21/arch/x86_64/config.in 2004-12-20 17:49:14.000000000 -0500
-@@ -90,6 +90,28 @@
-    define_bool CONFIG_NUMA y
- fi
-+choice 'Bigger Stack Size Support' \
-+     "off    CONFIG_NOBIGSTACK \
-+      16KB   CONFIG_STACK_SIZE_16KB \
-+      32KB   CONFIG_STACK_SIZE_32KB \
-+      64KB   CONFIG_STACK_SIZE_64KB" off
-+
-+if [ "$CONFIG_NOBIGSTACK" = "y" ]; then
-+   define_int CONFIG_STACK_SIZE_SHIFT 1
-+else
-+  if [ "$CONFIG_STACK_SIZE_16KB" = "y" ]; then
-+     define_int CONFIG_STACK_SIZE_SHIFT 2
-+  else
-+    if [ "$CONFIG_STACK_SIZE_32KB" = "y" ]; then
-+      define_int CONFIG_STACK_SIZE_SHIFT 3
-+   else
-+      if [ "$CONFIG_STACK_SIZE_64KB" = "y" ]; then
-+        define_int CONFIG_STACK_SIZE_SHIFT 4
-+      fi
-+    fi
-+  fi
-+fi
-+ 
- endmenu
- mainmenu_option next_comment
-Index: linux-2.4.21/arch/x86_64/kernel/smpboot.c
-===================================================================
---- linux-2.4.21.orig/arch/x86_64/kernel/smpboot.c     2004-09-11 10:16:17.000000000 -0400
-+++ linux-2.4.21/arch/x86_64/kernel/smpboot.c  2004-12-20 17:49:14.000000000 -0500
-@@ -756,7 +756,7 @@
-                       Dprintk("CPU has booted.\n");
-               } else {
-                       boot_status = 1;
--                      if (*((volatile unsigned char *)phys_to_virt(8192))
-+                      if (*((volatile unsigned char *)phys_to_virt(THREAD_SIZE))
-                                       == 0xA5)
-                               /* trampoline started but...? */
-                               printk("Stuck ??\n");
-@@ -775,7 +775,7 @@
-       }
-       /* mark "stuck" area as not stuck */
--      *((volatile unsigned int *)phys_to_virt(8192)) = 0;
-+      *((volatile unsigned int *)phys_to_virt(THREAD_SIZE)) = 0;
-       
-       return cpu; 
- }
-Index: linux-2.4.21/arch/x86_64/kernel/traps.c
-===================================================================
---- linux-2.4.21.orig/arch/x86_64/kernel/traps.c       2004-09-11 10:16:25.000000000 -0400
-+++ linux-2.4.21/arch/x86_64/kernel/traps.c    2004-12-20 17:49:14.000000000 -0500
-@@ -240,7 +240,7 @@
-       unsigned long rsp = tsk->thread.rsp;
-       /* User space on another CPU? */
--      if ((rsp ^ (unsigned long)tsk) & (PAGE_MASK<<1))
-+      if ((rsp ^ (unsigned long)tsk) & ~(THREAD_SIZE - 1))
-               return;
-       show_trace((unsigned long *)rsp);
- }
-Index: linux-2.4.21/arch/x86_64/vmlinux.lds
-===================================================================
---- linux-2.4.21.orig/arch/x86_64/vmlinux.lds  2003-06-13 10:51:32.000000000 -0400
-+++ linux-2.4.21/arch/x86_64/vmlinux.lds       2004-12-20 17:49:14.000000000 -0500
-@@ -72,7 +72,8 @@
-   .vsyscall_1 ADDR(.vsyscall_0) + 1024: AT (LOADADDR(.vsyscall_0) + 1024) { *(.vsyscall_1) }
-   . = LOADADDR(.vsyscall_0) + 4096;
--  . = ALIGN(8192);            /* init_task */
-+/* chose the biggest of the possible stack sizes here? */
-+  . = ALIGN(65536);           /* init_task */
-   .data.init_task : { *(.data.init_task) }
-   . = ALIGN(4096); 
-Index: linux-2.4.21/include/asm-i386/current.h
-===================================================================
---- linux-2.4.21.orig/include/asm-i386/current.h       1998-08-14 19:35:22.000000000 -0400
-+++ linux-2.4.21/include/asm-i386/current.h    2004-12-20 17:47:25.000000000 -0500
-@@ -1,15 +1,64 @@
- #ifndef _I386_CURRENT_H
- #define _I386_CURRENT_H
-+#include <asm/page.h>
-+
-+/*
-+ * Configurable page sizes on i386, mainly for debugging purposes.
-+ * (c) Balbir Singh
-+ */
-+
-+/* enumerate the values, include/asm-i386/hw_irq.h in particular needs this */
-+#if (PAGE_SIZE != 4096)
-+#error PAGE_SIZE != 4096 unsupported
-+#endif
-+
-+#if (CONFIG_STACK_SIZE_SHIFT == 0)
-+#define THREAD_SIZE   4096
-+#elif (CONFIG_STACK_SIZE_SHIFT == 1)
-+#define THREAD_SIZE   8192
-+#elif (CONFIG_STACK_SIZE_SHIFT == 2)
-+#define THREAD_SIZE   16384
-+#elif (CONFIG_STACK_SIZE_SHIFT == 3)
-+#define THREAD_SIZE   32768
-+#elif (CONFIG_STACK_SIZE_SHIFT == 4)
-+#define THREAD_SIZE   65536
-+#else
-+#error CONFIG_STACK_SIZE_SHIFT > 4 unsupported
-+#endif
-+
-+#if (CONFIG_STACK_SIZE_SHIFT != 1) && defined(CONFIG_X86_4G)
-+#error Large stacks with 4G/4G split unsupported
-+#endif
-+
-+#ifdef __ASSEMBLY__
-+
-+#define GET_CURRENT(reg) \
-+      movl $-THREAD_SIZE, reg; \
-+      andl %esp, reg
-+
-+#else /* __ASSEMBLY__ */
-+
-+#define __alloc_task_struct() \
-+  ((struct task_struct *) __get_free_pages(GFP_KERNEL, CONFIG_STACK_SIZE_SHIFT))
-+
-+#define __free_task_struct(p) do { \
-+  BUG_ON((p)->state < TASK_ZOMBIE); \
-+  free_pages((unsigned long) (p), CONFIG_STACK_SIZE_SHIFT); \
-+} while(0)
-+
-+#define INIT_TASK_SIZE THREAD_SIZE
- struct task_struct;
- static inline struct task_struct * get_current(void)
- {
-       struct task_struct *current;
--      __asm__("andl %%esp,%0; ":"=r" (current) : "0" (~8191UL));
-+      __asm__("andl %%esp,%0; ":"=r" (current) : "0" (~(THREAD_SIZE - 1)));
-       return current;
-  }
-  
- #define current get_current()
-+#endif /* __ASSEMBLY__ */
-+
- #endif /* !(_I386_CURRENT_H) */
-Index: linux-2.4.21/include/asm-i386/hw_irq.h
-===================================================================
---- linux-2.4.21.orig/include/asm-i386/hw_irq.h        2004-09-11 10:16:19.000000000 -0400
-+++ linux-2.4.21/include/asm-i386/hw_irq.h     2004-12-20 17:47:25.000000000 -0500
-@@ -135,21 +135,17 @@
-       "                                                               \
-       /* load the real stack - keep the offset */                     \
-                                                                       \
--      movl $-8192, %ebx;                                              \
-+      movl $- " STR(THREAD_SIZE) ", %ebx;                             \
-       andl %esp, %ebx;                                                \
-       movl 36(%ebx), %edx;                                            \
-       movl %esp, %ebx;                                                \
--      andl $0x1fff, %ebx;                                             \
-+      andl $( " STR(THREAD_SIZE) "-1), %ebx;                          \
-       orl %ebx, %edx;                                                 \
-       movl %edx, %esp;"
- #define IRQ_NAME2(nr) nr##_interrupt(void)
- #define IRQ_NAME(nr) IRQ_NAME2(IRQ##nr)
--#define GET_CURRENT \
--      "movl %esp, %ebx\n\t" \
--      "andl $-8192, %ebx\n\t"
--
- /*
-  *    SMP has a few special interrupts for IPI messages
-  */
-Index: linux-2.4.21/include/asm-i386/processor.h
-===================================================================
---- linux-2.4.21.orig/include/asm-i386/processor.h     2004-09-11 10:16:39.000000000 -0400
-+++ linux-2.4.21/include/asm-i386/processor.h  2004-12-20 17:47:25.000000000 -0500
-@@ -14,6 +14,7 @@
- #include <asm/types.h>
- #include <asm/sigcontext.h>
- #include <asm/cpufeature.h>
-+#include <asm/current.h>
- #include <linux/cache.h>
- #include <linux/config.h>
- #include <linux/threads.h>
-@@ -490,10 +491,6 @@
- #define KSTK_EIP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1019])
- #define KSTK_ESP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1022])
--#define THREAD_SIZE (2*PAGE_SIZE)
--#define __alloc_task_struct() ((struct task_struct *) __get_free_pages(GFP_KERNEL,1))
--#define __free_task_struct(p) do { BUG_ON((p)->state < TASK_ZOMBIE); free_pages((unsigned long) (p), 1); } while (0)
--
- #define init_task     (init_task_union.task)
- #define init_stack    (init_task_union.stack)
-Index: linux-2.4.21/include/asm-x86_64/current.h
-===================================================================
---- linux-2.4.21.orig/include/asm-x86_64/current.h     2002-11-28 18:53:15.000000000 -0500
-+++ linux-2.4.21/include/asm-x86_64/current.h  2004-12-20 17:49:14.000000000 -0500
-@@ -5,6 +5,7 @@
- struct task_struct;
- #include <asm/pda.h>
-+#include <asm/page.h>
- static inline struct task_struct *get_current(void) 
- { 
-Index: linux-2.4.21/include/asm-x86_64/page.h
-===================================================================
---- linux-2.4.21.orig/include/asm-x86_64/page.h        2004-09-11 10:16:20.000000000 -0400
-+++ linux-2.4.21/include/asm-x86_64/page.h     2004-12-20 17:49:14.000000000 -0500
-@@ -27,8 +27,8 @@
- /* We still hope 8K is enough, but ... */
- /* Currently it is actually ~6k. This would change when task_struct moves into
-    an own slab. */
--#define THREAD_ORDER    1
--#define THREAD_SIZE    (2*PAGE_SIZE)
-+#define THREAD_ORDER   CONFIG_STACK_SIZE_SHIFT 
-+#define THREAD_SIZE    ((1 << CONFIG_STACK_SIZE_SHIFT) * PAGE_SIZE)
- #define INIT_TASK_SIZE THREAD_SIZE
- #define CURRENT_MASK (~(THREAD_SIZE-1))
-Index: linux-2.4.21/include/asm-x86_64/processor.h
-===================================================================
---- linux-2.4.21.orig/include/asm-x86_64/processor.h   2004-09-11 10:16:39.000000000 -0400
-+++ linux-2.4.21/include/asm-x86_64/processor.h        2004-12-20 17:50:00.000000000 -0500
-@@ -406,7 +406,7 @@
-    are already there. When you run out of stack try this first. */
- #define __alloc_task_struct() ((struct task_struct *) __get_free_pages(GFP_KERNEL,1))
--#define  __free_task_struct(p) free_pages((unsigned long) (p), 1)
-+#define  __free_task_struct(p) free_pages((unsigned long) (p), THREAD_ORDER)
-   
- #define init_task     (init_task_union.task)
- #define init_stack    (init_task_union.stack)