Re: [PATCH] reduce large do_mount stack usage with noinlines

Andrew Morton
2008-02-06T22:35:52Z

On Wed, 06 Feb 2008 16:13:58 -0600
Eric Sandeen <sandeen@redhat.com> wrote:

> do_mount() uses a whopping 616 bytes of stack on x86_64 in
> 2.6.24-mm1, largely thanks to gcc inlining the various helper
> functions.

hm, sizeof(nameidata)=136 and I can see about three of them on the stack.
Must have missed something.

> noinlining these can slim it down a lot; on my box this patch
> gets it down to 168, which is mostly the struct nameidata nd;
> left on the stack.
>
> These functions are called only as do_mount() helpers;
> none of them should be in any path that would see a performance
> benefit from inlining...
>

Does the patch actually help? I mean, if a() calls b() and both use N
bytes of locals, our worst-case stack usage remains ~2N whether or not b()
was inlined in a()? In fact, uninlining makes things a little worse due to
callframe stuff.

> -static int do_change_type(struct nameidata *nd, int flag)
> +static noinline int do_change_type(struct nameidata *nd, int flag)

There's no way for the reader to work out why this is here, so I do think
it should be commented somewhere.