[PATCH net v3] net: Force inlining of checksum functions in net/checksum.h

Masahiro Yamada masahiroy at kernel.org
Fri Feb 18 03:17:27 AEDT 2022


On Fri, Feb 18, 2022 at 12:15 AM David Laight <David.Laight at aculab.com> wrote:
>
> From: Christophe Leroy
> > Sent: 17 February 2022 14:55
> >
> > Le 17/02/2022 à 15:50, Christophe Leroy a écrit :
> > > Adding Ingo, Andrew and Nick as they were involved in the subjet,
> > >
> > > Le 17/02/2022 à 14:36, David Laight a écrit :
> > >> 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.
> > >
> > > Do you mean that the two following commits should be reverted:
> > >
> > > - 889b3c1245de ("compiler: remove CONFIG_OPTIMIZE_INLINING entirely")
> > > - 4c4e276f6491 ("net: Force inlining of checksum functions in
> > > net/checksum.h")
> >
> > Of course not the above one (copy/paste error), but:
> > - ac7c3e4ff401 ("compiler: enable CONFIG_OPTIMIZE_INLINING forcibly")
>
> That's the one I looked at.



No.  Not that one.

The commit you presumably want to revert is:

a771f2b82aa2 ("[PATCH] Add a section about inlining to
Documentation/CodingStyle")

This is now referred to as "__always_inline disease", though.




CONFIG_OPTIMIZE_INLINING has 14 years of history for x86.
See commit 60a3cdd06394 ("x86: add optimized inlining").
We always give gcc freedom to not inline functions marked as inline.




-- 
Best Regards
Masahiro Yamada


More information about the Linuxppc-dev mailing list