[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LFD.1.10.0808261212530.3363@nehalem.linux-foundation.org>
Date: Tue, 26 Aug 2008 12:18:53 -0700 (PDT)
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Jamie Lokier <jamie@...reable.org>
cc: Adrian Bunk <bunk@...nel.org>,
Rusty Russell <rusty@...tcorp.com.au>,
"Alan D. Brunelle" <Alan.Brunelle@...com>,
"Rafael J. Wysocki" <rjw@...k.pl>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Kernel Testers List <kernel-testers@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Arjan van de Ven <arjan@...ux.intel.com>,
Ingo Molnar <mingo@...e.hu>, linux-embedded@...r.kernel.org
Subject: Re: [Bug #11342] Linux 2.6.27-rc3: kernel BUG at mm/vmalloc.c -
bisected
On Tue, 26 Aug 2008, Jamie Lokier wrote:
>
> A function which is only called from one place should, if everything
> made sense, _never_ use more stack through being inlined.
But that's simply not true.
See the whole discussion.
The problem is that if you inline that function, the stack usage of the
newly inlined function is now added to ALL THE OTHER paths too!
So the case we had in module loading was that yes, we had a function with
a big stack footprint, but it was NOT in the deep path.
But by inlining it, it now moved the stack footprint "up" one level to
another function, and now the big stack footprint really _was_ in the deep
path, because the caller was involved in a much deeper chain.
So inlining moves the code up the callchain, and that is a problem for the
backtrace, but that's "just" a debugging issue. But it also moves the
stack footprint up the callchain, and that can actually be a correctness
issue.
Of course, a compiler doesn't _have_ to do that. A compiler _could_ have
multiple different stack footprints for a single function, and do liveness
analysis etc. But no sane compiler probably does that, because it's very
painful indeed, and it's not even an issue if you aren't stack-limited
(and being stack-limited is really just a kernel thing).
(Yeah, it can be an issue even if you have a big stack, in that you get
worse cache behaviour, so a dense stack footprint _would_ help. But the
complexity of stack liveness analysis is almost certainly not worth the
relatively small gains it would get on some odd cases).
Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists