Re: [patch] reduce stack usage of sanitize_e820_map

Linus Torvalds
2002-08-16T15:21:23Z

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.

Linus