Christophe Leroy
dfe537b0c9
net: Force inlining of checksum functions in net/checksum.h
commit 5486f5bf790b5c664913076c3194b8f916a5c7ad upstream.
All functions defined as static inline in net/checksum.h are
meant to be inlined for performance reason.
But since commit ac7c3e4ff4 ("compiler: enable
CONFIG_OPTIMIZE_INLINING forcibly") the compiler is allowed to
uninline functions when it wants.
Fair enough in the general case, but for tiny performance critical
checksum helpers that's counter-productive.
The problem mainly arises when selecting CONFIG_CC_OPTIMISE_FOR_SIZE,
Those helpers being 'static inline' in header files you suddenly find
them duplicated many times in the resulting vmlinux.
Here is a typical exemple when building powerpc pmac32_defconfig
with CONFIG_CC_OPTIMISE_FOR_SIZE. csum_sub() appears 4 times:
c04a23cc <csum_sub>:
c04a23cc: 7c 84 20 f8 not r4,r4
c04a23d0: 7c 63 20 14 addc r3,r3,r4
c04a23d4: 7c 63 01 94 addze r3,r3
c04a23d8: 4e 80 00 20 blr
...
c04a2ce8: 4b ff f6 e5 bl c04a23cc <csum_sub>
...
c04a2d2c: 4b ff f6 a1 bl c04a23cc <csum_sub>
...
c04a2d54: 4b ff f6 79 bl c04a23cc <csum_sub>
...
c04a754c <csum_sub>:
c04a754c: 7c 84 20 f8 not r4,r4
c04a7550: 7c 63 20 14 addc r3,r3,r4
c04a7554: 7c 63 01 94 addze r3,r3
c04a7558: 4e 80 00 20 blr
...
c04ac930: 4b ff ac 1d bl c04a754c <csum_sub>
...
c04ad264: 4b ff a2 e9 bl c04a754c <csum_sub>
...
c04e3b08 <csum_sub>:
c04e3b08: 7c 84 20 f8 not r4,r4
c04e3b0c: 7c 63 20 14 addc r3,r3,r4
c04e3b10: 7c 63 01 94 addze r3,r3
c04e3b14: 4e 80 00 20 blr
...
c04e5788: 4b ff e3 81 bl c04e3b08 <csum_sub>
...
c04e65c8: 4b ff d5 41 bl c04e3b08 <csum_sub>
...
c0512d34 <csum_sub>:
c0512d34: 7c 84 20 f8 not r4,r4
c0512d38: 7c 63 20 14 addc r3,r3,r4
c0512d3c: 7c 63 01 94 addze r3,r3
c0512d40: 4e 80 00 20 blr
...
c0512dfc: 4b ff ff 39 bl c0512d34 <csum_sub>
...
c05138bc: 4b ff f4 79 bl c0512d34 <csum_sub>
...
Restore the expected behaviour by using __always_inline for all
functions defined in net/checksum.h
vmlinux size is even reduced by 256 bytes with this patch:
text data bss dec hex filename
6980022 2515362 194384 9689768 93daa8 vmlinux.before
6979862 2515266 194384 9689512 93d9a8 vmlinux.now
Fixes: ac7c3e4ff4 ("compiler: enable CONFIG_OPTIMIZE_INLINING forcibly")
Cc: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: Nick Desaulniers <ndesaulniers@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
2022-03-02 11:41:08 +01:00 |
| .. |
|
acpi
|
ACPICA: actypes.h: Expand the ACPI_ACCESS_ definitions
|
2022-01-27 09:19:45 +01:00 |
|
asm-generic
|
module/ftrace: handle patchable-function-entry
|
2022-02-23 11:59:56 +01:00 |
|
clocksource
|
|
|
|
crypto
|
crypto: public_key: fix overflow during implicit conversion
|
2021-09-22 12:26:21 +02:00 |
|
drm
|
|
|
|
dt-bindings
|
|
|
|
keys
|
|
|
|
kvm
|
|
|
|
linux
|
tee: export teedev_open() and teedev_close_context()
|
2022-03-02 11:41:04 +01:00 |
|
math-emu
|
|
|
|
media
|
|
|
|
misc
|
|
|
|
net
|
net: Force inlining of checksum functions in net/checksum.h
|
2022-03-02 11:41:08 +01:00 |
|
pcmcia
|
|
|
|
ras
|
|
|
|
rdma
|
RDMA/netlink: Add __maybe_unused to static inline in C file
|
2021-11-26 10:47:18 +01:00 |
|
scsi
|
|
|
|
soc
|
|
|
|
sound
|
ALSA: hda: hdac_ext_stream: fix potential locking issues
|
2021-11-26 10:47:23 +01:00 |
|
target
|
scsi: target: Fix ordered tag handling
|
2021-11-26 10:47:16 +01:00 |
|
trace
|
f2fs: fix up f2fs_lookup tracepoints
|
2021-11-26 10:47:17 +01:00 |
|
uapi
|
uapi: fix linux/nfc.h userspace compilation errors
|
2022-01-05 12:37:45 +01:00 |
|
vdso
|
|
|
|
video
|
|
|
|
xen
|
xen: sync include/xen/interface/io/ring.h with Xen's newest version
|
2021-12-01 09:23:35 +01:00 |