From: Andrew Morton <akpm@zip.com.au>
To: vda@port.imtp.ilyichevsk.odessa.ua
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] syscall latency improvement #1
Date: Mon, 28 Jan 2002 02:30:04 -0800 [thread overview]
Message-ID: <3C55282C.7D607CFB@zip.com.au> (raw)
In-Reply-To: <18993.1011984842@warthog.cambridge.redhat.com> <Pine.LNX.4.33.0201251626490.2042-100000@penguin.transmeta.com> <3C51FF0C.D3B1E2F7@zip.com.au>, <3C51FF0C.D3B1E2F7@zip.com.au> <200201281018.g0SAIIE22462@Port.imtp.ilyichevsk.odessa.ua>
Denis Vlasenko wrote:
>
> > <thinks of another>
> >
> > s/inline//g
>
> I like this.
Well, it's a fairly small optimisation, but it's easy.
I did a patch a while back: http://www.zip.com.au/~akpm/linux/2.4/2.4.17-pre1/inline.patch
This is purely against core kernel files:
drivers/block/ll_rw_blk.c | 18 ++-------------
fs/binfmt_elf.c | 4 +--
fs/block_dev.c | 2 -
fs/dcache.c | 8 +++---
fs/inode.c | 6 ++---
fs/locks.c | 8 +++---
fs/namei.c | 14 ++++++------
fs/namespace.c | 42 ++++++++++++++++++++++++++++++++++++
fs/open.c | 4 +--
fs/read_write.c | 2 -
fs/stat.c | 2 -
fs/super.c | 2 -
include/linux/fs_struct.h | 53 +++-------------------------------------------
kernel/exit.c | 10 ++++----
kernel/fork.c | 4 +--
kernel/module.c | 2 -
kernel/sched.c | 6 ++---
kernel/signal.c | 3 --
kernel/sys.c | 2 -
kernel/timer.c | 2 -
lib/rwsem.c | 4 +--
mm/filemap.c | 4 +--
mm/highmem.c | 2 -
mm/memory.c | 2 -
mm/mmap.c | 4 +--
mm/slab.c | 14 ++++++------
And it reduces the kernel image by 11 kbytes. That's not much
RAM, but it's a lot of cache. It's almost all hot-path stuff.
> ...
> * replace those with big_inline
> * #define it to 'inline' or to '' (nothing) and compare kernel sizes
> * make it CONFIG_xxx option if it worth the trouble
The first patch should be against Documentation/CodingStyle.
What are we trying to achieve here? What are the guidelines
for when-to and when-to-not? I'd say:
- If a function has a single call site and is static then it
is always correct to inline.
- If a function is very small (20-30 bytes) then inlining
is correct even if it has many call sites.
- If a function is less-small, and has only one or two
*commonly called* call sites, then inlining is OK.
- If a function is a leaf function, then it is more inlinable
than a function which makes another function call.
fs/inode.c:__sync_one() violates all the above quite
outrageously :)
-
next prev parent reply other threads:[~2002-01-28 10:38 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-01-25 18:54 [PATCH] syscall latency improvement #1 David Howells
2002-01-25 22:35 ` Robert Love
2002-01-26 10:07 ` Nigel Gamble
2002-01-25 23:07 ` Paul Mackerras
2002-01-26 0:39 ` Linus Torvalds
2002-01-26 0:57 ` Andrew Morton
2002-01-26 1:20 ` Linus Torvalds
2002-01-26 4:00 ` Jamie Lokier
2002-01-28 14:18 ` Denis Vlasenko
2002-01-28 10:30 ` Andrew Morton [this message]
2002-01-28 15:28 ` Jeff Dike
2002-01-29 0:53 ` Rusty Russell
2002-01-29 12:54 ` Pavel Machek
2002-01-29 12:59 ` Denis Vlasenko
2002-02-21 7:10 ` Cameron Simpson
2002-01-26 18:39 ` [PATCH] " Alan Cox
2002-01-27 19:59 ` Jamie Lokier
[not found] <18993.1011984842@warthog.cambridge.redhat.com.suse.lists.linux.kernel>
[not found] ` <Pine.LNX.4.33.0201251626490.2042-100000@penguin.transmeta.com.suse.lists.linux.kernel>
2002-01-26 1:24 ` Andi Kleen
2002-01-26 1:53 ` Linus Torvalds
2002-01-26 2:03 ` Andi Kleen
2002-01-26 2:14 ` Linus Torvalds
2002-01-26 2:26 ` Andi Kleen
2002-01-26 2:39 ` Dave Jones
2002-01-26 2:53 ` Davide Libenzi
2002-01-26 2:10 ` Andrew Morton
2002-01-26 3:06 ` Robert Love
2002-01-26 3:20 ` Robert Love
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=3C55282C.7D607CFB@zip.com.au \
--to=akpm@zip.com.au \
--cc=linux-kernel@vger.kernel.org \
--cc=vda@port.imtp.ilyichevsk.odessa.ua \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.