x86, generic: mark complex bitops.h inlines as __always_inline
authorAndi Kleen <andi@firstfloor.org>
Mon, 12 Jan 2009 22:01:15 +0000 (23:01 +0100)
committerIngo Molnar <mingo@elte.hu>
Tue, 13 Jan 2009 17:56:30 +0000 (18:56 +0100)
commitc8399943bdb70fef78798b97f975506ecc99e039
tree3d7cdf853bdfc012b9ea8513ab775238b94d6f75
parent4a922a969cb0190ce4580d4b064e2ac35f3ac9bf
x86, generic: mark complex bitops.h inlines as __always_inline

Impact: reduce kernel image size

Hugh Dickins noticed that older gcc versions when the kernel
is built for code size didn't inline some of the bitops.

Mark all complex x86 bitops that have more than a single
asm statement or two as always inline to avoid this problem.

Probably should be done for other architectures too.

Ingo then found a better fix that only requires
a single line change, but it unfortunately only
works on gcc 4.3.

On older gccs the original patch still makes a ~0.3% defconfig
difference with CONFIG_OPTIMIZE_INLINING=y.

With gcc 4.1 and a defconfig like build:

    6116998 1138540  883788 8139326  7c323e vmlinux-oi-with-patch
    6137043 1138540  883788 8159371  7c808b vmlinux-optimize-inlining

~20k / 0.3% difference.

Signed-off-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/include/asm/bitops.h
include/asm-generic/bitops/__ffs.h
include/asm-generic/bitops/__fls.h
include/asm-generic/bitops/fls.h
include/asm-generic/bitops/fls64.h