From: Menglong Dong <redacted>
Sometimes, gcc will optimize the function by spliting it to two or
more functions. In this case, kfree_skb_reason() is splited to
kfree_skb_reason and kfree_skb_reason.part.0. However, the
function/tracepoint trace_kfree_skb() in it needs the return address
of kfree_skb_reason().
This split makes the call chains becomes:
kfree_skb_reason() -> kfree_skb_reason.part.0 -> trace_kfree_skb()
which makes the return address that passed to trace_kfree_skb() be
kfree_skb().
Therefore, prevent this kind of optimization to kfree_skb_reason() by
making the optimize level to "O1". I think these should be better
method instead of this "O1", but I can't figure it out......
This optimization CAN happen, which depend on the behavior of gcc.
I'm not able to reproduce it in the latest kernel code, but it happens
in my kernel of version 5.4.119. Maybe the latest code already do someting
that prevent this happen?
Signed-off-by: Menglong Dong <redacted>
---
include/linux/compiler_attributes.h | 2 ++
net/core/skbuff.c | 3 ++-
2 files changed, 4 insertions(+), 1 deletion(-)
Two notes on this: please use the double underscore form:
`__optimize__` and keep the file sorted (it should go after
`__overloadable__`, since we sort by the actual attribute name).
Thanks!
Cheers,
Miguel
From: Miguel Ojeda <hidden> Date: 2022-08-11 14:35:49
On Thu, Aug 11, 2022 at 4:34 PM Miguel Ojeda
[off-list ref] wrote:
Two notes on this: please use the double underscore form:
`__optimize__` and keep the file sorted (it should go after
`__overloadable__`, since we sort by the actual attribute name).
On Thu, Aug 11, 2022 at 10:35 PM Miguel Ojeda
[off-list ref] wrote:
On Thu, Aug 11, 2022 at 4:34 PM Miguel Ojeda
[off-list ref] wrote:
quoted
Two notes on this: please use the double underscore form:
`__optimize__` and keep the file sorted (it should go after
`__overloadable__`, since we sort by the actual attribute name).
s/after/before
Okay......Thanks for your reminds :/
Menglong Dong