User: Password:
Subscribe / Log in / New account

4K stacks by default?

4K stacks by default?

Posted Apr 24, 2008 17:44 UTC (Thu) by proski (subscriber, #104)
In reply to: 4K stacks by default? by jzbiciak
Parent article: 4K stacks by default?

From Linux 2.6.25, file include/asm-x86/page_64.h:

#define THREAD_ORDER    1
This looks like 8k to my untrained eye.

(Log in to post comments)

4K stacks by default?

Posted Apr 24, 2008 18:28 UTC (Thu) by jzbiciak (subscriber, #5246) [Link]

Currently both x86 and x86-64 have 8K stacks by default as I recall. That wasn't what I was talking about. I was referring to this comment in the original article:

We see them regularly enough on x86 to know that the first question to any strange crash is "are you using 4k stacks?". In comparison, I have never heard of a single stack overflow on x86_64....

That's just a general statement that suggests x86-64 places less demand on the stack than x86.

4K stacks by default?

Posted Apr 24, 2008 21:48 UTC (Thu) by proski (subscriber, #104) [Link]

Please check your logic.  That suggests that x86_64 is significantly less likely to run out of
8k than i386 out of 4k.

But if you are right about reduced usage of stack for automatic variables and parameter
passing, it means that 4k stacks could be attempted on x86_64.

4K stacks by default?

Posted Apr 24, 2008 22:44 UTC (Thu) by jzbiciak (subscriber, #5246) [Link]

There was a lengthier comment that indicated it wasn't a "4K on x86 vs. 8K on x86-64" situation that was quoted over on KernelTrap. That perhaps biased my reading of the quote above to not read the same into it that you did. That exchange was:

From: Eric Sandeen <sandeen@...>
Subject: Re: x86: 4kstacks default
Date: Apr 19, 10:36 pm 2008

Arjan van de Ven wrote:

> On the flipside the arguments tend to be
> 1) certain stackings of components still runs the risk of overflowing
> 2) I want to run ndiswrapper
> 3) general, unspecified uneasyness.
> For 1), we need to know which they are, and then solve them, because even on x86-64 with 8k stacks
> they can be a problem (just because the stack frames are bigger, although not quite double, there).

Except, apparently, not, at least in my experience.

Ask the xfs guys if they see stack overflows on x86_64, or on x86.

I've personally never seen common stack problems with xfs on x86_64, but
it's very common on x86.  I don't have a great answer for why, but
that's my anecdotal evidence.

I agree that without this additional context it's easy to interpret the shorter quote the way you did. Sorry about that.

Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds