A tunnel_key set action allocates a per CPU dst cache for the software
path. This takes about 5 KB per action on a 128 CPU host. An action
flagged skip_sw never runs in software and the dst_cache helpers handle
a missing cache, so skip the allocation. Since the previous patch, a
skip_sw filter alone is enough. A replace leaves the flags of an
existing action unchanged, so check these rather than the request ones.
Reviewed-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Alexandre Cassen <redacted>
---
net/sched/act_tunnel_key.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c
index 503834853306..28d9cc080101 100644
--- a/net/sched/act_tunnel_key.c
+++ b/net/sched/act_tunnel_key.c
@@ -481,9 +481,13 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
}
#ifdef CONFIG_DST_CACHE
- ret = dst_cache_init(&metadata->u.tun_info.dst_cache, GFP_KERNEL);
- if (ret)
- goto release_tun_meta;
+ if (!((exists ? (*a)->tcfa_flags : act_flags) &
+ TCA_ACT_FLAGS_SKIP_SW)) {
+ ret = dst_cache_init(&metadata->u.tun_info.dst_cache,
+ GFP_KERNEL);
+ if (ret)
+ goto release_tun_meta;
+ }
#endif
if (opts_len) {--
2.43.0