Re: [2.6 patch] i386: always use 4k stacks

Horst von Brand
2005-12-16T19:06:35Z

Adrian Bunk <bunk@stusta.de> wrote:
> On Fri, Dec 16, 2005 at 01:56:58PM +1100, Neil Brown wrote:

[...]

> gcc can figure out itself that static functions called only once should
> be inline (except currently on i386 due to no-unit-at-a-time, see
> below).
>
> > These add up to over 300 bytes on the stack.
> > Looking at each of these, I see that nfsd_write (which includes
> > nfsd_vfs_write) contributes 0x8c to stack usage itself!!
> >
> > It turns out this is because it puts a 'struct iattr' on the stack so
> > it can kill suid if needed. The following patch saves about 50 bytes
> > off the stack in this call path.
> >...

And if you set up a compound literal for the task then? It is just used to
shove data into the called function.

My short test case (attached) has a smaller stack with the compound
literal (gcc-4.1, Fedora rawhide on i686), and IMHO it is clearer what is
going on here.

> This works currently on i386 (and only on i386) because we are using
> -fno-unit-at-a-time there.
>
> In the medium-term, we want to get rid of no-unit-at-a-time because this
> makes the code both bigger and slower, and I'm therefore not a big fan
> of this kind of workarounds.
>
> If this struct is really a problem (which I doubt considering it's
> size), I'd prefer it being kmalloc'ed.

Nodz.
--
Dr. Horst H. von Brand User #22616 counter.li.org
Departamento de Informatica Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria +56 32 654239
Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513