From: Jean Delvare <khali@linux-fr.org>
To: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Mauro Carvalho Chehab <mchehab@infradead.org>,
i2c@lm-sensors.org, video4linux-list@redhat.com
Subject: Re: [PATCH] video: limit stack usage of ir-kbd-i2c.c
Date: Thu, 28 Feb 2008 19:29:24 +0100 [thread overview]
Message-ID: <20080228192924.1ab1dc66@hyperion.delvare> (raw)
In-Reply-To: <20080227102309.GA6698@joi>
On Wed, 27 Feb 2008 11:23:26 +0100, Marcin Slusarz wrote:
> On Tue, Feb 26, 2008 at 11:23:20PM +0100, Jean Delvare wrote:
> > * You can move the handling of some ioctls to dedicated functions, just
> > like I did in i2c-dev:
> > http://lists.lm-sensors.org/pipermail/i2c/2008-February/003010.html
> > However there is a risk that gcc will inline these functions (that's
> > what happened to me...) Not sure how to prevent gcc from inlining.
>
> There's "noinline" attribute in linux/compiler.h (compiler-gcc.h actually)
> for these situations.
I didn't know about noinline, thanks for the tip. It works as expected,
however in the case of i2cdev_ioctl I'm not sure if it's worth it.
Without it, I have:
0x02ae i2cdev_ioctl [i2c-dev]: 192
With noinline, I have:
0x02ac i2cdev_ioctl_smbus [i2c-dev]: 112
0x05bc i2cdev_ioctl_rdrw [i2c-dev]: 112
0x087e i2cdev_ioctl [i2c-dev]: 32
32 + 112 = 144, 192 - 144 = only 48 bytes saved on the stack, at the
price of some performance loss. OTOH this makes the binary slightly
smaller (not sure why), which is always nice:
add/remove: 2/0 grow/shrink: 0/1 up/down: 1121/-1182 (-61)
function old new delta
i2cdev_ioctl_rdrw - 696 +696
i2cdev_ioctl_smbus - 425 +425
i2cdev_ioctl 1482 300 -1182
--
Jean Delvare
prev parent reply other threads:[~2008-02-28 18:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-25 20:51 [PATCH] video: limit stack usage of ir-kbd-i2c.c Marcin Slusarz
2008-02-26 12:32 ` Jean Delvare
2008-02-26 21:03 ` Marcin Slusarz
2008-02-26 22:23 ` Jean Delvare
2008-02-27 10:23 ` Marcin Slusarz
2008-02-27 10:33 ` Mauro Carvalho Chehab
2008-02-28 18:29 ` Jean Delvare [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080228192924.1ab1dc66@hyperion.delvare \
--to=khali@linux-fr.org \
--cc=i2c@lm-sensors.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcin.slusarz@gmail.com \
--cc=mchehab@infradead.org \
--cc=video4linux-list@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox