public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* [Linux-ia64] [PATCH] 2.5 - Another user stack size patch
@ 2003-05-23 18:15 Martin Hicks
  2003-05-23 18:22 ` DESAI,RAJESH (HP-Cupertino,ex1)
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Martin Hicks @ 2003-05-23 18:15 UTC (permalink / raw)
  To: linux-ia64

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

-- 
Wild Open Source Inc.                  mort@wildopensource.com


# 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	mort@green.i.bork.org	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	mort@green.i.bork.org	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 */		\


^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [Linux-ia64] [PATCH] 2.5 - Another user stack size patch
  2003-05-23 18:15 [Linux-ia64] [PATCH] 2.5 - Another user stack size patch Martin Hicks
@ 2003-05-23 18:22 ` DESAI,RAJESH (HP-Cupertino,ex1)
  2003-05-23 18:34 ` Martin Hicks
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: DESAI,RAJESH (HP-Cupertino,ex1) @ 2003-05-23 18:22 UTC (permalink / raw)
  To: linux-ia64

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

-- 
Wild Open Source Inc.                  mort@wildopensource.com


# 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	mort@green.i.bork.org	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	mort@green.i.bork.org	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
Linux-IA64@linuxia64.org
http://lists.linuxia64.org/lists/listinfo/linux-ia64


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Linux-ia64] [PATCH] 2.5 - Another user stack size patch
  2003-05-23 18:15 [Linux-ia64] [PATCH] 2.5 - Another user stack size patch Martin Hicks
  2003-05-23 18:22 ` DESAI,RAJESH (HP-Cupertino,ex1)
@ 2003-05-23 18:34 ` Martin Hicks
  2003-05-23 18:37 ` DESAI,RAJESH (HP-Cupertino,ex1)
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Martin Hicks @ 2003-05-23 18:34 UTC (permalink / raw)
  To: linux-ia64


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

-- 
Wild Open Source Inc.                  mort@wildopensource.com


^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [Linux-ia64] [PATCH] 2.5 - Another user stack size patch
  2003-05-23 18:15 [Linux-ia64] [PATCH] 2.5 - Another user stack size patch Martin Hicks
  2003-05-23 18:22 ` DESAI,RAJESH (HP-Cupertino,ex1)
  2003-05-23 18:34 ` Martin Hicks
@ 2003-05-23 18:37 ` DESAI,RAJESH (HP-Cupertino,ex1)
  2003-05-23 19:04 ` Martin Hicks
  2003-05-23 19:28 ` Martin Hicks
  4 siblings, 0 replies; 6+ messages in thread
From: DESAI,RAJESH (HP-Cupertino,ex1) @ 2003-05-23 18:37 UTC (permalink / raw)
  To: linux-ia64

Any idea - what kind of apps? 

-R
--
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

-- 
Wild Open Source Inc.                  mort@wildopensource.com


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Linux-ia64] [PATCH] 2.5 - Another user stack size patch
  2003-05-23 18:15 [Linux-ia64] [PATCH] 2.5 - Another user stack size patch Martin Hicks
                   ` (2 preceding siblings ...)
  2003-05-23 18:37 ` DESAI,RAJESH (HP-Cupertino,ex1)
@ 2003-05-23 19:04 ` Martin Hicks
  2003-05-23 19:28 ` Martin Hicks
  4 siblings, 0 replies; 6+ messages in thread
From: Martin Hicks @ 2003-05-23 19:04 UTC (permalink / raw)
  To: linux-ia64

[-- Attachment #1: Type: text/plain, Size: 356 bytes --]


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

-- 
Wild Open Source Inc.                  mort@wildopensource.com

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [Linux-ia64] [PATCH] 2.5 - Another user stack size patch
  2003-05-23 18:15 [Linux-ia64] [PATCH] 2.5 - Another user stack size patch Martin Hicks
                   ` (3 preceding siblings ...)
  2003-05-23 19:04 ` Martin Hicks
@ 2003-05-23 19:28 ` Martin Hicks
  4 siblings, 0 replies; 6+ messages in thread
From: Martin Hicks @ 2003-05-23 19:28 UTC (permalink / raw)
  To: linux-ia64

On Fri, May 23, 2003 at 02:15:55PM -0400, Martin Hicks wrote:
> 
> 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.

> 
> 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);

        ^^^^^ This line right here is wrong and should be removed.

> +        return PAGE_ALIGN(STACK_TOP - stack_base + PAGE_SIZE);
> +}
> +
> +
>  /*

-- 
Wild Open Source Inc.                  mort@wildopensource.com

# 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	mort@green.i.bork.org	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	mort@green.i.bork.org	1.1103
# Remove an extra #include that isn't needed.
# --------------------------------------------
# 03/05/23	mort@green.i.bork.org	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 */		\



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2003-05-23 19:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-23 18:15 [Linux-ia64] [PATCH] 2.5 - Another user stack size patch Martin Hicks
2003-05-23 18:22 ` DESAI,RAJESH (HP-Cupertino,ex1)
2003-05-23 18:34 ` Martin Hicks
2003-05-23 18:37 ` DESAI,RAJESH (HP-Cupertino,ex1)
2003-05-23 19:04 ` Martin Hicks
2003-05-23 19:28 ` Martin Hicks

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox