xfs-masters
[Top] [All Lists]

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

To: Adrian Bunk <bunk@xxxxxxxxx>
Subject: [xfs-masters] Re: [2.6 patch] i386: always use 4k stacks
From: Horst von Brand <vonbrand@xxxxxxxxxxxx>
Date: Fri, 16 Dec 2005 16:03:14 -0300
Cc: Neil Brown <neilb@xxxxxxx>, Dave Jones <davej@xxxxxxxxxx>, Andrew Morton <akpm@xxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, arjan@xxxxxxxxxxxxx, xfs-masters@xxxxxxxxxxx, nathans@xxxxxxx
In-reply-to: Message from Adrian Bunk <bunk@stusta.de> of "Fri, 16 Dec 2005 13:18:05 BST." <20051216121805.GX23349@stusta.de>
Reply-to: xfs-masters@xxxxxxxxxxx
Sender: xfs-masters-bounce@xxxxxxxxxxx
Adrian Bunk <bunk@xxxxxxxxx> 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


<Prev in Thread] Current Thread [Next in Thread>