Re: 4k stacks in 2.6

From: Jörn Engel
Date: Thu May 27 2004 - 10:02:54 EST


On Thu, 27 May 2004 16:49:16 +0200, Andrea Arcangeli wrote:
> On Thu, May 27, 2004 at 04:15:47PM +0200, Jörn Engel wrote:
> >
> > Would it be possible to add something short to the function preamble
> > on x86 then? Similar to this code, maybe:
> >
> > if (!(stack_pointer & 0xe00)) /* less than 512 bytes left */
> > *NULL = 1;
> >
> > Not sure how this can be translated into short and fast x86 assembler,
> > but if it is possible, I would really like to have it. Then all we
> > have left to do is make sure no function ever uses more than 512
> > bytes. Famous last words, I know.
>
> If it would be _inlined_ it would be *much* faster, but it would likely
> be measurable anyways. Less measurable though. There's no way with gcc
> to inline the above in the preamble, one could hack gcc for it though
> (there's exactly an asm preable thing in gcc that is the one that is
> currently implemented as call mcount plus the register saving, chaning
> it to the above may be feasible, though it would need a new option in
> gcc)

It is on my list, although I care more about ppc32. Can anyone
translate the above into assembler?

> another nice thing to have (this one zerocost at runtime) would be a
> way to set a limit on the size of the local variables for each function.
> gcc knows that value very well, it's the sub it does on the stack
> pointer the first few asm instructions after the call. That would
> reduce the common mistakes. An equivalent script is the one from Keith
> Owens checking the vmlinux binary after compilation but I'm afraid
> people runs that one only after the fact.

Plus the script is wrong sometimes. I have had trouble with sizes
around 4G or 2G, and never found the time to really figure out what's
going on. Might be an alloca thing that got misparsed somehow.

Having the check in gcc should cause less surprises.

Jörn

--
It's not whether you win or lose, it's how you place the blame.
-- unknown
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/