Re: [patch] reduce stack usage of sanitize_e820_map

From: Linus Torvalds (
Date: Fri Aug 16 2002 - 10:27:43 EST

On Fri, 16 Aug 2002, Denis Vlasenko wrote:
> >
> > Currently, sanitize_e820_map uses 0x738 bytes of stack. The patch below
> > moves the arrays into __initdata, reducing stack usage to 0x34 bytes.
> Is that a real problem? sanitize_e820_map will be called just once at init
> time...

Well, I would actually want us to have some tools that just say "you can't
do that". A flag to gcc that says "-Wstack-depth=200" that just makes gcc
refuse to compile functions that have too big of a stack requirement, so
that we'd see some of these things immediately.

Somebody had a script that greps the kernel disassembly for big stack
changes, I suspect Ben used something like that. That's obviously
equivalent, but doesn't force developers to be careful.

Of course, the ultimate thing checks what the dynamic depths are by
looking at the call graph, but since you can avoid the worst stuff by just
checking for static issues I htink that's worth it.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

This archive was generated by hypermail 2b29 : Fri Aug 23 2002 - 22:00:12 EST