RE: [PATCH net v3] net: Force inlining of checksum functions in net/checksum.h
From: David Laight <hidden>
Date: 2022-02-17 13:36:15
Also in:
lkml, netdev
From: David Laight <hidden>
Date: 2022-02-17 13:36:15
Also in:
lkml, netdev
From: Christophe Leroy
Sent: 17 February 2022 12:19
All functions defined as static inline in net/checksum.h are
meant to be inlined for performance reason.
But since commit ac7c3e4ff401 ("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.There isn't a real justification for allowing the compiler to 'not inline' functions in that commit. It rather seems backwards. The kernel sources don't really have anything marked 'inline' that shouldn't always be inlined. If there are any such functions they are few and far between. I've had enough trouble (elsewhere) getting gcc to inline static functions that are only called once. I ended up using 'always_inline'. (That is 4k of embedded object code that will be too slow if it ever spills a register to stack.) David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)