linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* TASK_UNMAPPED_BASE & stack location
@ 2003-04-25 20:32 Martin J. Bligh
  2003-04-25 21:01 ` H. Peter Anvin
                   ` (2 more replies)
  0 siblings, 3 replies; 24+ messages in thread
From: Martin J. Bligh @ 2003-04-25 20:32 UTC (permalink / raw)
  To: linux-kernel, linux-mm mailing list; +Cc: Andrew Morton

Is there any good reason we can't remove TASK_UNMAPPED_BASE, and just shove
libraries directly above the program text? Red Hat seems to have patches to
dynamically tune it on a per-processes basis anyway ...

Moreover, can we put the stack back where it's meant to be, below the
program text, in that wasted 128MB of virtual space? Who really wants 
> 128MB of stack anyway (and can't fix their app)?

I'm sure there's some horrible reason we can't do this ... would just like
to know what it is. If it's "standards compilance" I don't really believe
it - we don't comply with the standard now anyway ...

M.

PS. Motivation is creating large shmem segments for DBs.

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

* Re: TASK_UNMAPPED_BASE & stack location
  2003-04-25 20:32 TASK_UNMAPPED_BASE & stack location Martin J. Bligh
@ 2003-04-25 21:01 ` H. Peter Anvin
  2003-04-25 21:10   ` Martin J. Bligh
  2003-04-25 23:52 ` badari
  2003-04-26 14:37 ` Rik van Riel
  2 siblings, 1 reply; 24+ messages in thread
From: H. Peter Anvin @ 2003-04-25 21:01 UTC (permalink / raw)
  To: linux-kernel

Followup to:  <459930000.1051302738@[10.10.2.4]>
By author:    "Martin J. Bligh" <mbligh@aracnet.com>
In newsgroup: linux.dev.kernel
>
> Is there any good reason we can't remove TASK_UNMAPPED_BASE, and just shove
> libraries directly above the program text? Red Hat seems to have patches to
> dynamically tune it on a per-processes basis anyway ...
> 
> Moreover, can we put the stack back where it's meant to be, below the
> program text, in that wasted 128MB of virtual space? Who really wants 
> > 128MB of stack anyway (and can't fix their app)?
> 

That space is NULL pointer trap zone.  NULL pointer trapping -> good.

	-hpa
-- 
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!
"Unix gives you enough rope to shoot yourself in the foot."
Architectures needed: ia64 m68k mips64 ppc ppc64 s390 s390x sh v850 x86-64

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

* Re: TASK_UNMAPPED_BASE & stack location
  2003-04-25 21:01 ` H. Peter Anvin
@ 2003-04-25 21:10   ` Martin J. Bligh
  2003-04-25 21:12     ` H. Peter Anvin
  2003-04-25 22:02     ` Timothy Miller
  0 siblings, 2 replies; 24+ messages in thread
From: Martin J. Bligh @ 2003-04-25 21:10 UTC (permalink / raw)
  To: H. Peter Anvin, linux-kernel

>> Is there any good reason we can't remove TASK_UNMAPPED_BASE, and just
>> shove libraries directly above the program text? Red Hat seems to have
>> patches to dynamically tune it on a per-processes basis anyway ...
>> 
>> Moreover, can we put the stack back where it's meant to be, below the
>> program text, in that wasted 128MB of virtual space? Who really wants 
>> > 128MB of stack anyway (and can't fix their app)?
> 
> That space is NULL pointer trap zone.  NULL pointer trapping -> good.

128Mb of it? The bottom page, or even a few Mb, sure ... 
but 128Mb seems somewhat excessive ...

M.


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

* Re: TASK_UNMAPPED_BASE & stack location
  2003-04-25 21:10   ` Martin J. Bligh
@ 2003-04-25 21:12     ` H. Peter Anvin
  2003-04-25 22:02     ` Timothy Miller
  1 sibling, 0 replies; 24+ messages in thread
From: H. Peter Anvin @ 2003-04-25 21:12 UTC (permalink / raw)
  To: Martin J. Bligh; +Cc: linux-kernel

Martin J. Bligh wrote:
>>>Is there any good reason we can't remove TASK_UNMAPPED_BASE, and just
>>>shove libraries directly above the program text? Red Hat seems to have
>>>patches to dynamically tune it on a per-processes basis anyway ...
>>>
>>>Moreover, can we put the stack back where it's meant to be, below the
>>>program text, in that wasted 128MB of virtual space? Who really wants 
>>>
>>>>128MB of stack anyway (and can't fix their app)?
>>
>>That space is NULL pointer trap zone.  NULL pointer trapping -> good.
> 
> 
> 128Mb of it? The bottom page, or even a few Mb, sure ... 
> but 128Mb seems somewhat excessive ...
> 

Perhaps, but large data structures can easily generate reasonably large
values when indirected.

	-hpa



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

* Re: TASK_UNMAPPED_BASE & stack location
  2003-04-25 21:10   ` Martin J. Bligh
  2003-04-25 21:12     ` H. Peter Anvin
@ 2003-04-25 22:02     ` Timothy Miller
  2003-04-25 22:06       ` Martin J. Bligh
  1 sibling, 1 reply; 24+ messages in thread
From: Timothy Miller @ 2003-04-25 22:02 UTC (permalink / raw)
  To: Martin J. Bligh; +Cc: H. Peter Anvin, linux-kernel



Martin J. Bligh wrote:

>>>Is there any good reason we can't remove TASK_UNMAPPED_BASE, and just
>>>shove libraries directly above the program text? Red Hat seems to have
>>>patches to dynamically tune it on a per-processes basis anyway ...
>>>
>>>Moreover, can we put the stack back where it's meant to be, below the
>>>program text, in that wasted 128MB of virtual space? Who really wants 
>>>      
>>>
>>>>128MB of stack anyway (and can't fix their app)?
>>>>        
>>>>
>>That space is NULL pointer trap zone.  NULL pointer trapping -> good.
>>    
>>
>
>128Mb of it? The bottom page, or even a few Mb, sure ... 
>but 128Mb seems somewhat excessive ..
>  
>
Considering that your process space is 4gig, and that that 128Mb doesn't 
really exist anywhere (no RAM, no page table entries, nothing), it's 
really not excessive.  If you're so strapped for process space that you 
need that extra 128Mb, then you probably shouldn't be using a 32-bit 
processor.

I understand that the stack exists somewhere high up in the address 
space.  And there's some other things up there (mmap space, etc).  What 
happens if the heap grows so much that it collides with one of those 
upper address spaces?  Out of memory?



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

* Re: TASK_UNMAPPED_BASE & stack location
  2003-04-25 22:02     ` Timothy Miller
@ 2003-04-25 22:06       ` Martin J. Bligh
  2003-04-25 23:15         ` H. Peter Anvin
                           ` (2 more replies)
  0 siblings, 3 replies; 24+ messages in thread
From: Martin J. Bligh @ 2003-04-25 22:06 UTC (permalink / raw)
  To: Timothy Miller; +Cc: H. Peter Anvin, linux-kernel

>> 128Mb of it? The bottom page, or even a few Mb, sure ... 
>> but 128Mb seems somewhat excessive ..
>>  
>> 
> Considering that your process space is 4gig, and that that 128Mb doesn't
> really exist anywhere (no RAM, no page table entries, nothing), it's
> really not excessive.  

I need the virtual space.

> If you're so strapped for process space that you
> need that extra 128Mb, then you probably shouldn't be using a 32-bit
> processor.

Point me at a cheap 32 cpu 64-bit machine. Market realities dicate
otherwise.

M.


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

* Re: TASK_UNMAPPED_BASE & stack location
  2003-04-25 22:06       ` Martin J. Bligh
@ 2003-04-25 23:15         ` H. Peter Anvin
  2003-04-25 23:19           ` Martin J. Bligh
  2003-04-26  0:42         ` Hugh Dickins
  2003-04-26 10:40         ` jlnance
  2 siblings, 1 reply; 24+ messages in thread
From: H. Peter Anvin @ 2003-04-25 23:15 UTC (permalink / raw)
  To: Martin J. Bligh; +Cc: Timothy Miller, linux-kernel

Martin J. Bligh wrote:
>>>128Mb of it? The bottom page, or even a few Mb, sure ... 
>>>but 128Mb seems somewhat excessive ..
>>> 
>>>
>>
>>Considering that your process space is 4gig, and that that 128Mb doesn't
>>really exist anywhere (no RAM, no page table entries, nothing), it's
>>really not excessive.  
> 
> 
> I need the virtual space.
> 

As far as I know, you're perfectly free to move the stack whereever you
feel like, as long as you map the space first, copy the contents and set
%esp.  mremap() is useful for this.

	-hpa


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

* Re: TASK_UNMAPPED_BASE & stack location
  2003-04-25 23:15         ` H. Peter Anvin
@ 2003-04-25 23:19           ` Martin J. Bligh
  2003-04-26  0:11             ` H. Peter Anvin
  0 siblings, 1 reply; 24+ messages in thread
From: Martin J. Bligh @ 2003-04-25 23:19 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Timothy Miller, linux-kernel

>>>> 128Mb of it? The bottom page, or even a few Mb, sure ... 
>>>> but 128Mb seems somewhat excessive ..
>>> 
>>> Considering that your process space is 4gig, and that that 128Mb doesn't
>>> really exist anywhere (no RAM, no page table entries, nothing), it's
>>> really not excessive.  
>> 
>> I need the virtual space.
> 
> As far as I know, you're perfectly free to move the stack whereever you
> feel like, as long as you map the space first, copy the contents and set
> %esp.  mremap() is useful for this.

Right ... I was just suggesting changing it by default. Was wondering if
anyone knew of anything it'd break. Your issue with NULL pointers is
interesting, but I'm not sure this would really affect that much ... the
stack is normally tiny in comparison.

M.


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

* Re: TASK_UNMAPPED_BASE & stack location
  2003-04-25 20:32 TASK_UNMAPPED_BASE & stack location Martin J. Bligh
  2003-04-25 21:01 ` H. Peter Anvin
@ 2003-04-25 23:52 ` badari
  2003-04-25 23:58   ` William Lee Irwin III
  2003-04-26 14:37 ` Rik van Riel
  2 siblings, 1 reply; 24+ messages in thread
From: badari @ 2003-04-25 23:52 UTC (permalink / raw)
  To: Martin J. Bligh; +Cc: linux-kernel, linux-mm mailing list, Andrew Morton

Martin,

Only problem with moving TASK_UNMAPPED_BASE right above
text would be - limiting the malloc() space. malloc() is clever enough
to mmap() and do the right thing. Once I moved TASK_UNMAPPED_BASE
to 0x10000000 and I could not run some of the programs with large
data segments.

Moving stacks below text would be tricky. pthread library knows
the placement of stack. It uses this to distinguish between
threads and pthreads manager.

I don't know what other librarys/apps depend on this kind of stuff.

Thanks,
Badari

static inline pthread_descr thread_self (void)
{
#ifdef THREAD_SELF
  return THREAD_SELF;
#else
  char *sp = CURRENT_STACK_FRAME;
  if (sp >= __pthread_initial_thread_bos)
    return &__pthread_initial_thread;
  else if (sp >= __pthread_manager_thread_bos
           && sp < __pthread_manager_thread_tos)
    return &__pthread_manager_thread;
  else if (__pthread_nonstandard_stacks)
    return __pthread_find_self();
  else
#ifdef _STACK_GROWS_DOWN
    return (pthread_descr)(((unsigned long)sp | (STACK_SIZE-1))+1) - 1;
#else
    return (pthread_descr)((unsigned long)sp &~ (STACK_SIZE-1));
#endif
#endif
}


"Martin J. Bligh" wrote:

> Is there any good reason we can't remove TASK_UNMAPPED_BASE, and just shove
> libraries directly above the program text? Red Hat seems to have patches to
> dynamically tune it on a per-processes basis anyway ...
>
> Moreover, can we put the stack back where it's meant to be, below the
> program text, in that wasted 128MB of virtual space? Who really wants
> > 128MB of stack anyway (and can't fix their app)?
>
> I'm sure there's some horrible reason we can't do this ... would just like
> to know what it is. If it's "standards compilance" I don't really believe
> it - we don't comply with the standard now anyway ...
>
> M.
>
> PS. Motivation is creating large shmem segments for DBs.
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"aart@kvack.org"> aart@kvack.org </a>


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

* Re: TASK_UNMAPPED_BASE & stack location
  2003-04-25 23:52 ` badari
@ 2003-04-25 23:58   ` William Lee Irwin III
  0 siblings, 0 replies; 24+ messages in thread
From: William Lee Irwin III @ 2003-04-25 23:58 UTC (permalink / raw)
  To: badari
  Cc: Martin J. Bligh, linux-kernel, linux-mm mailing list, Andrew Morton

On Fri, Apr 25, 2003 at 04:52:05PM -0700, badari wrote:
> Only problem with moving TASK_UNMAPPED_BASE right above
> text would be - limiting the malloc() space. malloc() is clever enough
> to mmap() and do the right thing. Once I moved TASK_UNMAPPED_BASE
> to 0x10000000 and I could not run some of the programs with large
> data segments.
> Moving stacks below text would be tricky. pthread library knows
> the placement of stack. It uses this to distinguish between
> threads and pthreads manager.
> I don't know what other librarys/apps depend on this kind of stuff.

STACK_TOP is easy to change to see what goes wrong; it's a single
#define in include/asm-i386/a.out.h

Someone should spin it up and see how well pthreads copes.


-- wli

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

* Re: TASK_UNMAPPED_BASE & stack location
  2003-04-25 23:19           ` Martin J. Bligh
@ 2003-04-26  0:11             ` H. Peter Anvin
  0 siblings, 0 replies; 24+ messages in thread
From: H. Peter Anvin @ 2003-04-26  0:11 UTC (permalink / raw)
  To: Martin J. Bligh; +Cc: Timothy Miller, linux-kernel

Martin J. Bligh wrote:
> 
> Right ... I was just suggesting changing it by default. Was wondering if
> anyone knew of anything it'd break. Your issue with NULL pointers is
> interesting, but I'm not sure this would really affect that much ... the
> stack is normally tiny in comparison.
> 

Normally, yes, but there are applications which use very large stacks.

	-hpa



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

* Re: TASK_UNMAPPED_BASE & stack location
  2003-04-25 22:06       ` Martin J. Bligh
  2003-04-25 23:15         ` H. Peter Anvin
@ 2003-04-26  0:42         ` Hugh Dickins
  2003-04-26  5:15           ` Martin J. Bligh
  2003-04-26 10:40         ` jlnance
  2 siblings, 1 reply; 24+ messages in thread
From: Hugh Dickins @ 2003-04-26  0:42 UTC (permalink / raw)
  To: Martin J. Bligh; +Cc: Timothy Miller, H. Peter Anvin, linux-kernel

On Fri, 25 Apr 2003, Martin J. Bligh wrote:
> >> 128Mb of it? The bottom page, or even a few Mb, sure ... 
> >> but 128Mb seems somewhat excessive ..

Yes.

> > Considering that your process space is 4gig, and that that 128Mb doesn't
> > really exist anywhere (no RAM, no page table entries, nothing), it's
> > really not excessive.  
> 
> I need the virtual space.

Plus you would (very often) get more physical.  i386 ELF text typically
begins at 0x08048000: putting stack just below text in many cases shares
page table between stack+text+data, and saves the page table at top of
user address space.

Hugh


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

* Re: TASK_UNMAPPED_BASE & stack location
  2003-04-26  0:42         ` Hugh Dickins
@ 2003-04-26  5:15           ` Martin J. Bligh
  0 siblings, 0 replies; 24+ messages in thread
From: Martin J. Bligh @ 2003-04-26  5:15 UTC (permalink / raw)
  To: Hugh Dickins; +Cc: Timothy Miller, H. Peter Anvin, linux-kernel

>> >> 128Mb of it? The bottom page, or even a few Mb, sure ... 
>> >> but 128Mb seems somewhat excessive ..
> 
> Yes.
> 
>> > Considering that your process space is 4gig, and that that 128Mb
>> > doesn't really exist anywhere (no RAM, no page table entries,
>> > nothing), it's really not excessive.  
>> 
>> I need the virtual space.
> 
> Plus you would (very often) get more physical.  i386 ELF text typically
> begins at 0x08048000: putting stack just below text in many cases shares
> page table between stack+text+data, and saves the page table at top of
> user address space.

A fine point - I hadn't thought of that. 
It just seems tidier all around ....

M.


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

* Re: TASK_UNMAPPED_BASE & stack location
  2003-04-25 22:06       ` Martin J. Bligh
  2003-04-25 23:15         ` H. Peter Anvin
  2003-04-26  0:42         ` Hugh Dickins
@ 2003-04-26 10:40         ` jlnance
  2003-04-26 15:39           ` Martin J. Bligh
  2 siblings, 1 reply; 24+ messages in thread
From: jlnance @ 2003-04-26 10:40 UTC (permalink / raw)
  To: Martin J. Bligh; +Cc: linux-kernel

On Fri, Apr 25, 2003 at 03:06:23PM -0700, Martin J. Bligh wrote:
> > If you're so strapped for process space that you
> > need that extra 128Mb, then you probably shouldn't be using a 32-bit
> > processor.
> 
> Point me at a cheap 32 cpu 64-bit machine. Market realities dicate
> otherwise.

Do you have a cheap 32 cpu 32-bit machine?  SMP?

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

* Re: TASK_UNMAPPED_BASE & stack location
  2003-04-25 20:32 TASK_UNMAPPED_BASE & stack location Martin J. Bligh
  2003-04-25 21:01 ` H. Peter Anvin
  2003-04-25 23:52 ` badari
@ 2003-04-26 14:37 ` Rik van Riel
  2003-04-26 15:03   ` William Lee Irwin III
  2 siblings, 1 reply; 24+ messages in thread
From: Rik van Riel @ 2003-04-26 14:37 UTC (permalink / raw)
  To: Martin J. Bligh; +Cc: linux-kernel, linux-mm mailing list, Andrew Morton

On Fri, 25 Apr 2003, Martin J. Bligh wrote:

> Is there any good reason we can't remove TASK_UNMAPPED_BASE, and just shove
> libraries directly above the program text? Red Hat seems to have patches to
> dynamically tune it on a per-processes basis anyway ...

What could be done is leave the stack where it is, but have
malloc() space and mmap() space grow towards each other:

0                                            3G
| |prog | malloc -->         <-- mmap | stack |

The stack will get the stack size ulimit size and the space
between where malloc and mmap start should be about 2.7 GB.

That 2.7 GB will of course by divided between malloc and mmap,
but the division will be done dynamically based on whoever
needs the space.  Much better than the current static 1:1.7
division...


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

* Re: TASK_UNMAPPED_BASE & stack location
  2003-04-26 14:37 ` Rik van Riel
@ 2003-04-26 15:03   ` William Lee Irwin III
  0 siblings, 0 replies; 24+ messages in thread
From: William Lee Irwin III @ 2003-04-26 15:03 UTC (permalink / raw)
  To: Rik van Riel
  Cc: Martin J. Bligh, linux-kernel, linux-mm mailing list, Andrew Morton

On Fri, 25 Apr 2003, Martin J. Bligh wrote:
>> Is there any good reason we can't remove TASK_UNMAPPED_BASE, and just shove
>> libraries directly above the program text? Red Hat seems to have patches to
>> dynamically tune it on a per-processes basis anyway ...

On Sat, Apr 26, 2003 at 10:37:11AM -0400, Rik van Riel wrote:
> What could be done is leave the stack where it is, but have
> malloc() space and mmap() space grow towards each other:
> 0                                            3G
> | |prog | malloc -->         <-- mmap | stack |
> The stack will get the stack size ulimit size and the space
> between where malloc and mmap start should be about 2.7 GB.
> That 2.7 GB will of course by divided between malloc and mmap,
> but the division will be done dynamically based on whoever
> needs the space.  Much better than the current static 1:1.7
> division...

My internal proposals (backed by code) already include this in addition
to relocating the stack (whose kernel side is trivial).


-- wli

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

* Re: TASK_UNMAPPED_BASE & stack location
  2003-04-26 10:40         ` jlnance
@ 2003-04-26 15:39           ` Martin J. Bligh
  0 siblings, 0 replies; 24+ messages in thread
From: Martin J. Bligh @ 2003-04-26 15:39 UTC (permalink / raw)
  To: jlnance; +Cc: linux-kernel

>> > If you're so strapped for process space that you
>> > need that extra 128Mb, then you probably shouldn't be using a 32-bit
>> > processor.
>> 
>> Point me at a cheap 32 cpu 64-bit machine. Market realities dicate
>> otherwise.
> 
> Do you have a cheap 32 cpu 32-bit machine?  SMP?

Comparitively, yes. They're about 1/8th of the price. Technically speaking
it's SMP, but NUMA, not UMA. Though I think Unisys's box is UMA (more or
less anyway).

M.


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

* Re: TASK_UNMAPPED_BASE & stack location
  2003-04-25 22:58     ` Andi Kleen
@ 2003-04-25 23:13       ` Hui Huang
  0 siblings, 0 replies; 24+ messages in thread
From: Hui Huang @ 2003-04-25 23:13 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Martin J. Bligh, linux-kernel

Andi Kleen wrote:
> 
>>I've moved PAGE_OFFSET around a lot (which moves the stack, as you say). 
>>Haven't seen it break anything yet ... IMHO it was broken anyway if this
>>hurts it. Obviously not something one could do in a stable kernel series,
>>but 2.5 seems like a perfect time for it to me ... unless I'm missing some
>>glibc / linker thing, it seems like a simple change.
> 
> 
> It at least broke Sun Java.
> 

That has been fixed in latest JDK.


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

* Re: TASK_UNMAPPED_BASE & stack location
@ 2003-04-25 23:02 Chuck Ebbert
  0 siblings, 0 replies; 24+ messages in thread
From: Chuck Ebbert @ 2003-04-25 23:02 UTC (permalink / raw)
  To: Martin J. Bligh; +Cc: linux-kernel

Martin J. Bligh wrote:


> Point me at a cheap 32 cpu 64-bit machine. Market realities dicate
> otherwise.


  Well it looks like the CPU is now available -- 'all' you need now
is a 32-port Hypertransport switch. :)

-------
 Chuck

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

* Re: TASK_UNMAPPED_BASE & stack location
@ 2003-04-25 23:02 Chuck Ebbert
  0 siblings, 0 replies; 24+ messages in thread
From: Chuck Ebbert @ 2003-04-25 23:02 UTC (permalink / raw)
  To: Andi Kleen; +Cc: linux-kernel

Andi Kleen wrote:


> (e.g. just moving __PAGE_OFFSET on amd64 to 4GB for 32bit broke some things)


  Wow.  The whole kernel is 'not there' as far as 32bit usermode
on x86-^h^h^h^hAMD64 is concerned then, right?

  Do you also get 'unlimited' space to run multiple 32-bit apps?


-------
 Chuck

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

* Re: TASK_UNMAPPED_BASE & stack location
       [not found]   ` <20030425225007$3fae@gated-at.bofh.it>
@ 2003-04-25 22:58     ` Andi Kleen
  2003-04-25 23:13       ` Hui Huang
  0 siblings, 1 reply; 24+ messages in thread
From: Andi Kleen @ 2003-04-25 22:58 UTC (permalink / raw)
  To: Martin J. Bligh; +Cc: linux-kernel

"Martin J. Bligh" <mbligh@aracnet.com> writes:

>>> Is there any good reason we can't remove TASK_UNMAPPED_BASE, and just
>>> shove libraries directly above the program text? Red Hat seems to have
>>> patches to dynamically tune it on a per-processes basis anyway ...
>> 
>> Yes. You won't get a continuous sbrk/brk heap then anymore. Not sure it
>> is a  big problem though.
>
> Me no understand. I think this *makes* it a contiguous space. The way I see
> it, we currently allocate from TASK_UNMAPPED_BASE up to the top, then start
> again above program text. Which seems a bit silly.

The space for brk is not completely continuous anymore, especially
when you use mmap() too.

Same with mmap.

Basically mmap() and brk/sbrk (=malloc) will fragment each other.

wli's suggestion of making it a personality makes sense.

> I've moved PAGE_OFFSET around a lot (which moves the stack, as you say). 
> Haven't seen it break anything yet ... IMHO it was broken anyway if this
> hurts it. Obviously not something one could do in a stable kernel series,
> but 2.5 seems like a perfect time for it to me ... unless I'm missing some
> glibc / linker thing, it seems like a simple change.

It at least broke Sun Java.

-Andi

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

* Re: TASK_UNMAPPED_BASE & stack location
  2003-04-25 21:54 ` Andi Kleen
  2003-04-25 22:06   ` William Lee Irwin III
@ 2003-04-25 22:10   ` Martin J. Bligh
  1 sibling, 0 replies; 24+ messages in thread
From: Martin J. Bligh @ 2003-04-25 22:10 UTC (permalink / raw)
  To: Andi Kleen; +Cc: linux-kernel

>> Is there any good reason we can't remove TASK_UNMAPPED_BASE, and just
>> shove libraries directly above the program text? Red Hat seems to have
>> patches to dynamically tune it on a per-processes basis anyway ...
> 
> Yes. You won't get a continuous sbrk/brk heap then anymore. Not sure it
> is a  big problem though.

Me no understand. I think this *makes* it a contiguous space. The way I see
it, we currently allocate from TASK_UNMAPPED_BASE up to the top, then start
again above program text. Which seems a bit silly.

> It's probably worth a sysctl at least.

mmm. I'd prefer a config option. Defaulting to 'y' ;-)

>> Moreover, can we put the stack back where it's meant to be, below the
>> program text, in that wasted 128MB of virtual space? Who really wants 
>>> 128MB of stack anyway (and can't fix their app)?
> 
> You could, but I bet it would break some programs
> (e.g. just moving __PAGE_OFFSET on amd64 to 4GB for 32bit broke some
> things)

I've moved PAGE_OFFSET around a lot (which moves the stack, as you say). 
Haven't seen it break anything yet ... IMHO it was broken anyway if this
hurts it. Obviously not something one could do in a stable kernel series,
but 2.5 seems like a perfect time for it to me ... unless I'm missing some
glibc / linker thing, it seems like a simple change.

M.


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

* Re: TASK_UNMAPPED_BASE & stack location
  2003-04-25 21:54 ` Andi Kleen
@ 2003-04-25 22:06   ` William Lee Irwin III
  2003-04-25 22:10   ` Martin J. Bligh
  1 sibling, 0 replies; 24+ messages in thread
From: William Lee Irwin III @ 2003-04-25 22:06 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Martin J. Bligh, linux-kernel

"Martin J. Bligh" <mbligh@aracnet.com> writes:
>> Is there any good reason we can't remove TASK_UNMAPPED_BASE, and just shove
>> libraries directly above the program text? Red Hat seems to have patches to
>> dynamically tune it on a per-processes basis anyway ...

On Fri, Apr 25, 2003 at 11:54:56PM +0200, Andi Kleen wrote:
> Yes. You won't get a continuous sbrk/brk heap then anymore. Not sure it is a 
> big problem though.
> But apparently Solaris/x86 is doing that.
> It's probably worth a sysctl at least.

How about a personality? It is a very slightly different ABI.


-- wli

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

* Re: TASK_UNMAPPED_BASE & stack location
       [not found] <20030425204012$4424@gated-at.bofh.it>
@ 2003-04-25 21:54 ` Andi Kleen
  2003-04-25 22:06   ` William Lee Irwin III
  2003-04-25 22:10   ` Martin J. Bligh
  0 siblings, 2 replies; 24+ messages in thread
From: Andi Kleen @ 2003-04-25 21:54 UTC (permalink / raw)
  To: Martin J. Bligh; +Cc: linux-kernel

"Martin J. Bligh" <mbligh@aracnet.com> writes:

> Is there any good reason we can't remove TASK_UNMAPPED_BASE, and just shove
> libraries directly above the program text? Red Hat seems to have patches to
> dynamically tune it on a per-processes basis anyway ...

Yes. You won't get a continuous sbrk/brk heap then anymore. Not sure it is a 
big problem though.

But apparently Solaris/x86 is doing that.

It's probably worth a sysctl at least.

> Moreover, can we put the stack back where it's meant to be, below the
> program text, in that wasted 128MB of virtual space? Who really wants 
>> 128MB of stack anyway (and can't fix their app)?

You could, but I bet it would break some programs
(e.g. just moving __PAGE_OFFSET on amd64 to 4GB for 32bit broke some things)

-Andi

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

end of thread, other threads:[~2003-04-26 15:27 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-04-25 20:32 TASK_UNMAPPED_BASE & stack location Martin J. Bligh
2003-04-25 21:01 ` H. Peter Anvin
2003-04-25 21:10   ` Martin J. Bligh
2003-04-25 21:12     ` H. Peter Anvin
2003-04-25 22:02     ` Timothy Miller
2003-04-25 22:06       ` Martin J. Bligh
2003-04-25 23:15         ` H. Peter Anvin
2003-04-25 23:19           ` Martin J. Bligh
2003-04-26  0:11             ` H. Peter Anvin
2003-04-26  0:42         ` Hugh Dickins
2003-04-26  5:15           ` Martin J. Bligh
2003-04-26 10:40         ` jlnance
2003-04-26 15:39           ` Martin J. Bligh
2003-04-25 23:52 ` badari
2003-04-25 23:58   ` William Lee Irwin III
2003-04-26 14:37 ` Rik van Riel
2003-04-26 15:03   ` William Lee Irwin III
     [not found] <20030425204012$4424@gated-at.bofh.it>
2003-04-25 21:54 ` Andi Kleen
2003-04-25 22:06   ` William Lee Irwin III
2003-04-25 22:10   ` Martin J. Bligh
     [not found] <20030425220018$6219@gated-at.bofh.it>
     [not found] ` <20030425220018$76b1@gated-at.bofh.it>
     [not found]   ` <20030425225007$3fae@gated-at.bofh.it>
2003-04-25 22:58     ` Andi Kleen
2003-04-25 23:13       ` Hui Huang
2003-04-25 23:02 Chuck Ebbert
2003-04-25 23:02 Chuck Ebbert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).