Re: [PATCH] tracing: uninline trace_trigger_soft_disabled()

From: Steven Rostedt
Date: Thu Feb 10 2022 - 09:26:24 EST


On Thu, 10 Feb 2022 09:47:52 +0100
Christophe Leroy <christophe.leroy@xxxxxxxxxx> wrote:

> On a ppc32 build with CONFIG_CC_OPTIMISE_FOR_SIZE,
> trace_trigger_soft_disabled() appears more than 50 times in vmlinux.
>
> That function is rather big for an inlined function, and
> it doesn't benefit much from inlining as its only parameter
> is a pointer to a struct in memory:

The number of parameters is not the reason for it being inlined. It's in a
*very* hot path, and a function call causes a noticeable performance hit.


>
> c003df60 <trace_trigger_soft_disabled>:
> c003df60: 94 21 ff f0 stwu r1,-16(r1)
> c003df64: 7c 08 02 a6 mflr r0
> c003df68: 90 01 00 14 stw r0,20(r1)
> c003df6c: bf c1 00 08 stmw r30,8(r1)
> c003df70: 83 e3 00 24 lwz r31,36(r3)
> c003df74: 73 e9 01 00 andi. r9,r31,256
> c003df78: 41 82 00 10 beq c003df88 <trace_trigger_soft_disabled+0x28>
> c003df7c: 38 60 00 00 li r3,0
> c003df80: 39 61 00 10 addi r11,r1,16
> c003df84: 4b fd 60 ac b c0014030 <_rest32gpr_30_x>
> c003df88: 73 e9 00 80 andi. r9,r31,128
> c003df8c: 7c 7e 1b 78 mr r30,r3
> c003df90: 41 a2 00 14 beq c003dfa4 <trace_trigger_soft_disabled+0x44>
> c003df94: 38 c0 00 00 li r6,0
> c003df98: 38 a0 00 00 li r5,0
> c003df9c: 38 80 00 00 li r4,0
> c003dfa0: 48 05 c5 f1 bl c009a590 <event_triggers_call>
> c003dfa4: 73 e9 00 40 andi. r9,r31,64
> c003dfa8: 40 82 00 28 bne c003dfd0 <trace_trigger_soft_disabled+0x70>
> c003dfac: 73 ff 02 00 andi. r31,r31,512
> c003dfb0: 41 82 ff cc beq c003df7c <trace_trigger_soft_disabled+0x1c>
> c003dfb4: 80 01 00 14 lwz r0,20(r1)
> c003dfb8: 83 e1 00 0c lwz r31,12(r1)
> c003dfbc: 7f c3 f3 78 mr r3,r30
> c003dfc0: 83 c1 00 08 lwz r30,8(r1)
> c003dfc4: 7c 08 03 a6 mtlr r0
> c003dfc8: 38 21 00 10 addi r1,r1,16
> c003dfcc: 48 05 6f 6c b c0094f38 <trace_event_ignore_this_pid>
> c003dfd0: 38 60 00 01 li r3,1
> c003dfd4: 4b ff ff ac b c003df80 <trace_trigger_soft_disabled+0x20>
>
> It doesn't benefit much from inlining as its only parameter is a
> pointer to a struct in memory so no constant folding is involved.
>
> Uninline it and move it into kernel/trace/trace_events_trigger.c
>
> It reduces the size of vmlinux by approximately 10 kbytes.

If you have an issue with the size, perhaps the function can be modified to
condense it. I'm happy to have a size reduction, but I will NACK making it
into a function call.

-- Steve