Re: 4k stacks in 2.6

Guy Sotomayor
2004-05-27T18:33:37Z

On Thu, 2004-05-27 at 07:55, Linus Torvalds wrote:

> "minor implementation detail"?
>
> You need to get to the thread info _some_ way, and you need to get to it
> _fast_. There are really no sane alternatives. I certainly do not want to
> play games with segments.

While segments on x86 are in general to be avoided (aka the 286
segmented memory models) they can be useful for some things in the
kernel.

Here's a couple of examples:
* dereference gs:0 to get the thread info. The first element in
the structure is its linear address (ie usable for being deref'd
off of DS).
* use SS to enforce the stack limit. This way you'd absolutely
get an exception when there was a stack overflow (underflow).
SS gets reloaded on entry into the kernel and on interrupts
anyway so there really shouldn't be a performance impact. I
haven't looked at all the (potential) gcc implications here so
this one may not be completely doable.
--

TTFN - Guy