1
0
mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2026-01-19 04:44:09 +00:00
Menglong Dong c205cc7534 net: skb: prevent the split of kfree_skb_reason() by gcc
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, introduce '__fix_address', which is the combination of
'__noclone' and 'noinline', and apply it to kfree_skb_reason() to
prevent to from being splited or made inline.

(Is it better to simply apply '__noclone oninline' to kfree_skb_reason?
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_reason().

Signed-off-by: Menglong Dong <imagedong@tencent.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2022-08-24 09:47:51 +01:00
..
2022-08-06 10:25:16 -07:00
2022-08-12 09:50:34 -07:00
2022-08-10 14:04:32 -07:00
2022-08-11 13:26:09 -07:00
2022-08-07 17:52:35 -07:00
2022-08-10 09:22:18 -07:00
2022-08-07 17:52:35 -07:00
2022-08-08 15:16:29 -07:00
2022-08-13 13:28:54 -07:00
2022-08-07 17:52:35 -07:00
2022-08-11 13:11:49 -07:00
2022-08-22 14:26:30 +01:00
2022-08-22 14:26:30 +01:00
2022-08-09 14:11:34 -04:00
2022-08-10 11:07:26 -07:00
2022-08-08 22:37:24 -04:00
2022-08-11 04:31:14 -04:00