Commit Graph

2 Commits

Author SHA1 Message Date
Menglong Dong 7d02938c42 net: skb: prevent the split of kfree_skb() by gcc
Sometimes, gcc will optimize the function by spliting it to two or
more functions. In this case, kfree_skb() is splited to
kfree_skb and kfree_skb.part.0. However, the
function/tracepoint trace_kfree_skb() in it needs the return address
of kfree_skb().

This split makes the call chains becomes:
  kfree_skb() -> kfree_skb.part.0 -> trace_kfree_skb()

which makes the return address that passed to trace_kfree_skb() be
kfree_skb().

Therefore, introduce '__fix_address', which is the combination of
'__noclone' and 'noinline', and apply it to kfree_skb() to
prevent to from being splited or made inline.

(Is it better to simply apply '__noclone oninline' to kfree_skb?
I'm thinking maybe other functions have the same problems)

Meanwhile, wrap 'skb_unref()' with 'unlikely()', as the compiler thinks
it is likely return true and splits kfree_skb().

Signed-off-by: Menglong Dong <imagedong@tencent.com>
2022-08-21 13:24:22 +08:00
Kaixu Xia 590eaf1fec Init Repo base on linux 5.4.32 long term, and add base tlinux kernel interfaces.
Signed-off-by: Kaixu Xia <kaixuxia@tencent.com>
2021-03-16 11:01:34 +08:00