Re: [PATCH net-next] net: lwtunnel: use GFP_KERNEL in build_state paths
From: Justin Iurman
Date: Mon Nov 09 2026 - 16:58:44 EST
On 11/6/26 12:40, Max Boone wrote:
Since 3d25eabbbf67 ("ip_tunnel: Add dst_cache support in lwtunnel_state
of ip tunnel"), build_state runs outside RCU and all its callers can
sleep, but paths still use GFP_ATOMIC.
For dst caches, that limits allocation to populated percpu pages. A
large burst of SRv6 nexthops outruns the refill worker and will fail
with -ENOMEM despite there being free memory:
percpu: allocation failed, size=40 align=8 atomic=1, atomic alloc
failed, no space left
Batching 20000 RTM_NEWNEXTHOP under QEMU gave 10-109 failures per run
before, none after.
This commit converts the allocations reached through ops->build_state()
and are called after the rcu_read_unlock():
- ila_build_state(), ioam6_build_state(), rpl_build_state(),
seg6_build_state(): build_state ops
- bpf_parse_prog(): only called from bpf_build_state()
- lwtunnel_state_alloc(): only called from build_state ops (also
affects mpls, ip/ip6 tunnel, xfrmi and seg6_local)
Signed-off-by: Max Boone <mboone@xxxxxxxxxx>
Reviewed-by: Debabrata Banerjee <dbanerje@xxxxxxxxxx>
Reviewed-by: Nick Hudson <nhudson@xxxxxxxxxx>
Reviewed-by: Justin Iurman <justin.iurman@xxxxxxxxx>