2.5 - Another user stack size patch
PATCH 1/1 2.5 - Another user stack size patch
David,
I hope this user stack size patch is better. This one places the RBS based on the max size of the stack. The max size of the user stack is 1TB.
The patch is against linux-ia64-2.5
mh
Signature · 85 lines
Wild Open Source Inc. [email protected] # This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.1101 -> 1.1103 # include/asm-ia64/processor.h 1.44 -> 1.45 # arch/ia64/mm/init.c 1.37 -> 1.39 # include/asm-ia64/a.out.h 1.4 -> 1.5 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/05/23 [email protected] 1.1102 # Change the maximum user stack size and the location of the Register # Backing Store to be based on the stack size rlimit. # -------------------------------------------- # 03/05/23 [email protected] 1.1103 # Remove an extra #include that isn't needed. # -------------------------------------------- # diff -Nru a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c --- a/arch/ia64/mm/init.c Fri May 23 14:14:06 2003 +++ b/arch/ia64/mm/init.c Fri May 23 14:14:06 2003 @@ -67,6 +67,17 @@ } } +inline unsigned long ia64_rbs_bot(void) +{ + unsigned long stack_base = current->rlim[RLIMIT_STACK].rlim_max; + + if (stack_base > MAX_USER_STACK) + stack_base = MAX_USER_STACK; + stack_base = PAGE_ALIGN(STACK_TOP - stack_base + PAGE_SIZE); + return PAGE_ALIGN(STACK_TOP - stack_base + PAGE_SIZE); +} + + /* * This performs some platform-dependent address space initialization. * On IA-64, we want to setup the VM area for the register backing @@ -86,7 +97,7 @@ vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL); if (vma) { vma->vm_mm = current->mm; - vma->vm_start = IA64_RBS_BOT; + vma->vm_start = ia64_rbs_bot(); vma->vm_end = vma->vm_start + PAGE_SIZE; vma->vm_page_prot = protection_map[VM_DATA_DEFAULT_FLAGS & 0x7]; vma->vm_flags = VM_READ|VM_WRITE|VM_MAYREAD|VM_MAYWRITE|VM_GROWSUP; diff -Nru a/include/asm-ia64/a.out.h b/include/asm-ia64/a.out.h --- a/include/asm-ia64/a.out.h Fri May 23 14:14:06 2003 +++ b/include/asm-ia64/a.out.h Fri May 23 14:14:06 2003 @@ -32,7 +32,7 @@ #ifdef __KERNEL__ # include <asm/page.h> # define STACK_TOP (0x6000000000000000UL + (1UL << (4*PAGE_SHIFT - 12)) - PAGE_SIZE) -# define IA64_RBS_BOT (STACK_TOP - 0x80000000L + PAGE_SIZE) /* bottom of reg. backing store */ +# define MAX_USER_STACK (1UL<<40) #endif #endif /* _ASM_IA64_A_OUT_H */ diff -Nru a/include/asm-ia64/processor.h b/include/asm-ia64/processor.h --- a/include/asm-ia64/processor.h Fri May 23 14:14:06 2003 +++ b/include/asm-ia64/processor.h Fri May 23 14:14:06 2003 @@ -296,6 +296,8 @@ .fph = {{{{0}}}, } \ } +extern unsigned long ia64_rbs_bot(void); + #define start_thread(regs,new_ip,new_sp) do { \ set_fs(USER_DS); \ regs->cr_ipsr = ((regs->cr_ipsr | (IA64_PSR_BITS_TO_SET | IA64_PSR_CPL)) \ @@ -303,7 +305,7 @@ regs->cr_iip = new_ip; \ regs->ar_rsc = 0xf; /* eager mode, privilege level 3 */ \ regs->ar_rnat = 0; \ - regs->ar_bspstore = IA64_RBS_BOT; \ + regs->ar_bspstore = ia64_rbs_bot(); \ regs->ar_fpsr = FPSR_DEFAULT; \ regs->loadrs = 0; \ regs->r8 = current->mm->dumpable; /* set "don't zap registers" flag */ \
So, what kind of apps need 1 TB stacks?
-R
--------------------------------------
David,
I hope this user stack size patch is better. This one places the RBS based on the max size of the stack. The max size of the user stack is 1TB.
The patch is against linux-ia64-2.5
mh
Signature · 104 lines
Wild Open Source Inc. [email protected] # This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.1101 -> 1.1103 # include/asm-ia64/processor.h 1.44 -> 1.45 # arch/ia64/mm/init.c 1.37 -> 1.39 # include/asm-ia64/a.out.h 1.4 -> 1.5 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/05/23 [email protected] 1.1102 # Change the maximum user stack size and the location of the Register # Backing Store to be based on the stack size rlimit. # -------------------------------------------- # 03/05/23 [email protected] 1.1103 # Remove an extra #include that isn't needed. # -------------------------------------------- # diff -Nru a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c --- a/arch/ia64/mm/init.c Fri May 23 14:14:06 2003 +++ b/arch/ia64/mm/init.c Fri May 23 14:14:06 2003 @@ -67,6 +67,17 @@ } } +inline unsigned long ia64_rbs_bot(void) +{ + unsigned long stack_base = current->rlim[RLIMIT_STACK].rlim_max; + + if (stack_base > MAX_USER_STACK) + stack_base = MAX_USER_STACK; + stack_base = PAGE_ALIGN(STACK_TOP - stack_base + PAGE_SIZE); + return PAGE_ALIGN(STACK_TOP - stack_base + PAGE_SIZE); +} + + /* * This performs some platform-dependent address space initialization. * On IA-64, we want to setup the VM area for the register backing @@ -86,7 +97,7 @@ vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL); if (vma) { vma->vm_mm = current->mm; - vma->vm_start = IA64_RBS_BOT; + vma->vm_start = ia64_rbs_bot(); vma->vm_end = vma->vm_start + PAGE_SIZE; vma->vm_page_prot = protection_map[VM_DATA_DEFAULT_FLAGS & 0x7]; vma->vm_flags VM_READ|VM_WRITE|VM_MAYREAD|VM_MAYWRITE|VM_GROWSUP; diff -Nru a/include/asm-ia64/a.out.h b/include/asm-ia64/a.out.h --- a/include/asm-ia64/a.out.h Fri May 23 14:14:06 2003 +++ b/include/asm-ia64/a.out.h Fri May 23 14:14:06 2003 @@ -32,7 +32,7 @@ #ifdef __KERNEL__ # include <asm/page.h> # define STACK_TOP (0x6000000000000000UL + (1UL << (4*PAGE_SHIFT - 12)) - PAGE_SIZE) -# define IA64_RBS_BOT (STACK_TOP - 0x80000000L + PAGE_SIZE) /* bottom of reg. backing store */ +# define MAX_USER_STACK (1UL<<40) #endif #endif /* _ASM_IA64_A_OUT_H */ diff -Nru a/include/asm-ia64/processor.h b/include/asm-ia64/processor.h --- a/include/asm-ia64/processor.h Fri May 23 14:14:06 2003 +++ b/include/asm-ia64/processor.h Fri May 23 14:14:06 2003 @@ -296,6 +296,8 @@ .fph = {{{{0}}}, } \ } +extern unsigned long ia64_rbs_bot(void); + #define start_thread(regs,new_ip,new_sp) do { \ set_fs(USER_DS); \ regs->cr_ipsr = ((regs->cr_ipsr | (IA64_PSR_BITS_TO_SET | IA64_PSR_CPL)) \ @@ -303,7 +305,7 @@ regs->cr_iip = new_ip; \ regs->ar_rsc = 0xf; /* eager mode, privilege level 3 */ \ regs->ar_rnat = 0; \ - regs->ar_bspstore = IA64_RBS_BOT; \ + regs->ar_bspstore = ia64_rbs_bot(); \ regs->ar_fpsr = FPSR_DEFAULT; \ regs->loadrs = 0; \ regs->r8 = current->mm->dumpable; /* set "don't zap registers" flag */ \ _______________________________________________ Linux-IA64 mailing list [email protected] http://lists.linuxia64.org/lists/listinfo/linux-ia64
Quoted 1 line · On Fri, May 23, 2003 at 02:22:56PM -0400, DESAI,RAJESH (HP-Cupertino,ex1) wrote:
So, what kind of apps need 1 TB stacks?
People from within SGI are claiming that some of their apps require 2GB of stack per processor, so even with existing systems we're looking at 128GB of stack space. I imagine that the high-end SSI NUMA clusters will get even bigger in the next while. The 1TB number was just a nice round number.
mh
Signature · 1 line
Wild Open Source Inc. [email protected]
Any idea - what kind of apps?
-R
--
Quoted 1 line · On Fri, May 23, 2003 at 02:22:56PM -0400, DESAI,RAJESH (HP-Cupertino,ex1) wrote:
So, what kind of apps need 1 TB stacks?
People from within SGI are claiming that some of their apps require 2GB of stack per processor, so even with existing systems we're looking at 128GB of stack space. I imagine that the high-end SSI NUMA clusters will get even bigger in the next while. The 1TB number was just a nice round number.
mh
Signature · 1 line
Wild Open Source Inc. [email protected]
Quoted 1 line · On Fri, May 23, 2003 at 11:37:00AM -0700, DESAI,RAJESH (HP-Cupertino,ex1) wrote:
Any idea - what kind of apps?
Just vague mention of OpenMP apps as well as Fortran code that allocates large automatic variables on the stack to improve parallel processing performance.
mh
Signature · 1 line
Wild Open Source Inc. [email protected]
Quoted 6 lines · Martin Hicks
David,
I hope this user stack size patch is better. This one places the RBS based on the max size of the stack. The max size of the user stack is 1TB.
Thanks to willy for pointing out an error in the patch. I forgot to delete a line of debug code.
Quoted 5 lines
diff -Nru
a/arch/ia64/mm/init.cb/arch/ia64/mm/init.c
arch/ia64/mm/init.c line 76
Quoted 10 lines
arch/ia64/mm/init.c +7
-0@@ -67,6 +67,17 @@ } } +inline unsigned long ia64_rbs_bot (void ) +{ +unsigned long stack_base = current->rlim[RLIMIT_STACK ].rlim_max; + +if (stack_base >MAX_USER_STACK ) + stack_base =MAX_USER_STACK ; + stack_base =PAGE_ALIGN (STACK_TOP - stack_base +PAGE_SIZE );
^^^^^ This line right here is wrong and should be removed.
Quoted 5 lines
arch/ia64/mm/init.c +4
-0+return PAGE_ALIGN (STACK_TOP - stack_base +PAGE_SIZE ); +} + +/*
Signature · 86 lines
Wild Open Source Inc. [email protected] # This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.1101 -> 1.1104 # include/asm-ia64/processor.h 1.44 -> 1.45 # arch/ia64/mm/init.c 1.37 -> 1.40 # include/asm-ia64/a.out.h 1.4 -> 1.5 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/05/23 [email protected] 1.1102 # Change the maximum user stack size and the location of the Register # Backing Store to be based on the stack size rlimit. # -------------------------------------------- # 03/05/23 [email protected] 1.1103 # Remove an extra #include that isn't needed. # -------------------------------------------- # 03/05/23 [email protected] 1.1104 # Fix a stupid bug that was left over from debug code. # -------------------------------------------- # diff -Nru a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c --- a/arch/ia64/mm/init.c Fri May 23 15:24:54 2003 +++ b/arch/ia64/mm/init.c Fri May 23 15:24:54 2003 @@ -67,6 +67,16 @@ } } +inline unsigned long ia64_rbs_bot(void) +{ + unsigned long stack_base = current->rlim[RLIMIT_STACK].rlim_max; + + if (stack_base > MAX_USER_STACK) + stack_base = MAX_USER_STACK; + return PAGE_ALIGN(STACK_TOP - stack_base + PAGE_SIZE); +} + + /* * This performs some platform-dependent address space initialization. * On IA-64, we want to setup the VM area for the register backing @@ -86,7 +96,7 @@ vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL); if (vma) { vma->vm_mm = current->mm; - vma->vm_start = IA64_RBS_BOT; + vma->vm_start = ia64_rbs_bot(); vma->vm_end = vma->vm_start + PAGE_SIZE; vma->vm_page_prot = protection_map[VM_DATA_DEFAULT_FLAGS & 0x7]; vma->vm_flags = VM_READ|VM_WRITE|VM_MAYREAD|VM_MAYWRITE|VM_GROWSUP; diff -Nru a/include/asm-ia64/a.out.h b/include/asm-ia64/a.out.h --- a/include/asm-ia64/a.out.h Fri May 23 15:24:54 2003 +++ b/include/asm-ia64/a.out.h Fri May 23 15:24:54 2003 @@ -32,7 +32,7 @@ #ifdef __KERNEL__ # include <asm/page.h> # define STACK_TOP (0x6000000000000000UL + (1UL << (4*PAGE_SHIFT - 12)) - PAGE_SIZE) -# define IA64_RBS_BOT (STACK_TOP - 0x80000000L + PAGE_SIZE) /* bottom of reg. backing store */ +# define MAX_USER_STACK (1UL<<40) #endif #endif /* _ASM_IA64_A_OUT_H */ diff -Nru a/include/asm-ia64/processor.h b/include/asm-ia64/processor.h --- a/include/asm-ia64/processor.h Fri May 23 15:24:54 2003 +++ b/include/asm-ia64/processor.h Fri May 23 15:24:54 2003 @@ -296,6 +296,8 @@ .fph = {{{{0}}}, } \ } +extern unsigned long ia64_rbs_bot(void); + #define start_thread(regs,new_ip,new_sp) do { \ set_fs(USER_DS); \ regs->cr_ipsr = ((regs->cr_ipsr | (IA64_PSR_BITS_TO_SET | IA64_PSR_CPL)) \ @@ -303,7 +305,7 @@ regs->cr_iip = new_ip; \ regs->ar_rsc = 0xf; /* eager mode, privilege level 3 */ \ regs->ar_rnat = 0; \ - regs->ar_bspstore = IA64_RBS_BOT; \ + regs->ar_bspstore = ia64_rbs_bot(); \ regs->ar_fpsr = FPSR_DEFAULT; \ regs->loadrs = 0; \ regs->r8 = current->mm->dumpable; /* set "don't zap registers" flag */ \