2008-03-30 23:04:39

by Denys Vlasenko

[permalink] [raw]
Subject: [PATCH] sb1000.c: stop inlining largish static functions

Hi Jeff,

Can you take this patch into your net driver fixes tree?

drivers/net/sb1000.c has lots of inlined static functions.

Mst of them are used at initialization, wait for some
hardware register to change (wait using yield, sleep etc),
or do slow port-based I/O. Inlining thse "for speed" makes no sense.

This patch removes "inline" from biggest static function
(regardless of number of callsites - gcc nowadays auto-inlines
statics with one callsite).

Size difference for 32bit x86:

text data bss dec hex filename
6299 129 0 6428 191c linux-2.6-ALLYES/drivers/net/sb1000.o
5418 129 0 5547 15ab linux-2.6.inline-ALLYES/drivers/net/sb1000.o

(I also see some other optimization opportunities,
will test and send a patch separately).

Signed-off-by: Denys Vlasenko <[email protected]>
--
vda


Attachments:
(No filename) (861.00 B)
deinline_sb1000.diff (11.15 kB)
Download all attachments

2008-03-30 23:16:52

by Denys Vlasenko

[permalink] [raw]
Subject: [PATCH] sb1000.c: make const arrays static

On Monday 31 March 2008 01:02, Denys Vlasenko wrote:
> Size difference for 32bit x86:
>
> text data bss dec hex filename
> 6299 129 0 6428 191c linux-2.6-ALLYES/drivers/net/sb1000.o
> 5418 129 0 5547 15ab linux-2.6.inline-ALLYES/drivers/net/sb1000.o
>
> (I also see some other optimization opportunities,
> will test and send a patch separately).

Here it is. It replaces automatic constant arrays a-la

const unsigned char Command0[6] = {0x80, 0x16, 0x00, 0x00, 0x00, 0x00};

with static ones. Size difference for 32bit x86:

text data bss dec hex filename
5418 129 0 5547 15ab linux-2.6.inline-ALLYES/drivers/net/sb1000.o
5396 129 0 5525 1595 linux-2.6.followup-ALLYES/drivers/net/sb1000.o

Signed-off-by: Denys Vlasenko <[email protected]>
--
vda


Attachments:
(No filename) (876.00 B)
sb1000_make_const_arrays_static.diff (6.32 kB)
Download all attachments