linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -mm] lib/rwsem.c: un-inline rwsem_down_failed_common()
@ 2006-08-28 20:04 Andreas Mohr
  2006-08-29  9:50 ` David Howells
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Mohr @ 2006-08-28 20:04 UTC (permalink / raw)
  To: Andrew Morton; +Cc: dhowells, linux-kernel

Un-inlining rwsem_down_failed_common() (two callsites) reduced
lib/rwsem.o on my Athlon, gcc 4.1.2 from 5935 to 5480 Bytes (455 Bytes saved).

I thus guess that reduced icache footprint (and better function caching)
is worth more than any function call overhead.

Compile-tested and run-tested on 2.6.18-rc4-mm3.


Signed-off-by: Andreas Mohr <andi@lisas.de>

--- linux-2.6.18-rc4-mm3.orig/lib/rwsem.c	2006-08-22 21:09:55.000000000 +0200
+++ linux-2.6.18-rc4-mm3/lib/rwsem.c	2006-09-05 21:52:09.000000000 +0200
@@ -146,7 +146,7 @@
 /*
  * wait for a lock to be granted
  */
-static inline struct rw_semaphore *
+static struct rw_semaphore *
 rwsem_down_failed_common(struct rw_semaphore *sem,
 			struct rwsem_waiter *waiter, signed long adjustment)
 {

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -mm] lib/rwsem.c: un-inline rwsem_down_failed_common()
  2006-08-28 20:04 [PATCH -mm] lib/rwsem.c: un-inline rwsem_down_failed_common() Andreas Mohr
@ 2006-08-29  9:50 ` David Howells
  2006-08-29  9:59   ` Arjan van de Ven
  0 siblings, 1 reply; 3+ messages in thread
From: David Howells @ 2006-08-29  9:50 UTC (permalink / raw)
  To: Andreas Mohr; +Cc: Andrew Morton, dhowells, linux-kernel

Andreas Mohr <andi@rhlx01.fht-esslingen.de> wrote:

> Un-inlining rwsem_down_failed_common() (two callsites) reduced
> lib/rwsem.o on my Athlon, gcc 4.1.2 from 5935 to 5480 Bytes (455 Bytes saved).

Maybe this should be judged according to CONFIG_CC_OPTIMIZE_FOR_SIZE.

David

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH -mm] lib/rwsem.c: un-inline rwsem_down_failed_common()
  2006-08-29  9:50 ` David Howells
@ 2006-08-29  9:59   ` Arjan van de Ven
  0 siblings, 0 replies; 3+ messages in thread
From: Arjan van de Ven @ 2006-08-29  9:59 UTC (permalink / raw)
  To: David Howells; +Cc: Andreas Mohr, Andrew Morton, linux-kernel

On Tue, 2006-08-29 at 10:50 +0100, David Howells wrote:
> Andreas Mohr <andi@rhlx01.fht-esslingen.de> wrote:
> 
> > Un-inlining rwsem_down_failed_common() (two callsites) reduced
> > lib/rwsem.o on my Athlon, gcc 4.1.2 from 5935 to 5480 Bytes (455 Bytes saved).
> 
> Maybe this should be judged according to CONFIG_CC_OPTIMIZE_FOR_SIZE.

gcc already does this if you don't manually specify the inline
keyword ;)

static functions get inlined if they're small enough in relation to the
nr of call sites, where "small enough" is a function of -O2 vs -Os. So
leaving away inline makes gcc do its smarts.


-- 
if you want to mail me at work (you don't), use arjan (at) linux.intel.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-08-29  9:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-28 20:04 [PATCH -mm] lib/rwsem.c: un-inline rwsem_down_failed_common() Andreas Mohr
2006-08-29  9:50 ` David Howells
2006-08-29  9:59   ` Arjan van de Ven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).