Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ipv6: remove max_size check inline with ipv4
commit af6d103 upstream. In ip6_dst_gc() replace: if (entries > gc_thresh) With: if (entries > ops->gc_thresh) Sending Ipv6 packets in a loop via a raw socket triggers an issue where a route is cloned by ip6_rt_cache_alloc() for each packet sent. This quickly consumes the Ipv6 max_size threshold which defaults to 4096 resulting in these warnings: [1] 99.187805] dst_alloc: 7728 callbacks suppressed [2] Route cache is full: consider increasing sysctl net.ipv6.route.max_size. . . [300] Route cache is full: consider increasing sysctl net.ipv6.route.max_size. When this happens the packet is dropped and sendto() gets a network is unreachable error: remaining pkt 200557 errno 101 remaining pkt 196462 errno 101 . . remaining pkt 126821 errno 101 Implement David Aherns suggestion to remove max_size check seeing that Ipv6 has a GC to manage memory usage. Ipv4 already does not check max_size. Here are some memory comparisons for Ipv4 vs Ipv6 with the patch: Test by running 5 instances of a program that sends UDP packets to a raw socket 5000000 times. Compare Ipv4 and Ipv6 performance with a similar program. Ipv4: Before test: MemFree: 29427108 kB Slab: 237612 kB ip6_dst_cache 1912 2528 256 32 2 : tunables 0 0 0 xfrm_dst_cache 0 0 320 25 2 : tunables 0 0 0 ip_dst_cache 2881 3990 192 42 2 : tunables 0 0 0 During test: MemFree: 29417608 kB Slab: 247712 kB ip6_dst_cache 1912 2528 256 32 2 : tunables 0 0 0 xfrm_dst_cache 0 0 320 25 2 : tunables 0 0 0 ip_dst_cache 44394 44394 192 42 2 : tunables 0 0 0 After test: MemFree: 29422308 kB Slab: 238104 kB ip6_dst_cache 1912 2528 256 32 2 : tunables 0 0 0 xfrm_dst_cache 0 0 320 25 2 : tunables 0 0 0 ip_dst_cache 3048 4116 192 42 2 : tunables 0 0 0 Ipv6 with patch: Errno 101 errors are not observed anymore with the patch. Before test: MemFree: 29422308 kB Slab: 238104 kB ip6_dst_cache 1912 2528 256 32 2 : tunables 0 0 0 xfrm_dst_cache 0 0 320 25 2 : tunables 0 0 0 ip_dst_cache 3048 4116 192 42 2 : tunables 0 0 0 During Test: MemFree: 29431516 kB Slab: 240940 kB ip6_dst_cache 11980 12064 256 32 2 : tunables 0 0 0 xfrm_dst_cache 0 0 320 25 2 : tunables 0 0 0 ip_dst_cache 3048 4116 192 42 2 : tunables 0 0 0 After Test: MemFree: 29441816 kB Slab: 238132 kB ip6_dst_cache 1902 2432 256 32 2 : tunables 0 0 0 xfrm_dst_cache 0 0 320 25 2 : tunables 0 0 0 ip_dst_cache 3048 4116 192 42 2 : tunables 0 0 0 Tested-by: Andrea Mayer <andrea.mayer@uniroma2.it> Signed-off-by: Jon Maxwell <jmaxwell37@gmail.com> Reviewed-by: David Ahern <dsahern@kernel.org> Link: https://lore.kernel.org/r/20230112012532.311021-1-jmaxwell37@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Cc: "Jitindar Singh, Suraj" <surajjs@amazon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
- linux-6.1.100-mpi
- linux-6.1.101-mpi
- linux-6.1.102-mpi
- linux-6.1.103-mpi
- linux-6.1.104-mpi
- linux-6.1.105-mpi
- linux-6.1.106-mpi
- linux-6.1.107-mpi
- linux-6.1.108-mpi
- linux-6.1.109-mpi
- linux-6.1.110-mpi
- linux-6.1.111-mpi
- linux-6.1.112-mpi
- linux-6.1.113-mpi
- linux-6.1.114-mpi
- linux-6.1.115-mpi
- linux-6.1.116-mpi
- linux-6.1.117-mpi
- linux-6.1.118-mpi
- linux-6.1.119-mpi
- linux-6.1.120-mpi
- linux-6.1.121-mpi
- linux-6.1.122-mpi
- linux-6.1.123-mpi
- linux-6.1.124-mpi
- linux-6.1.125-mpi
- linux-6.1.126-mpi
- linux-6.1.127-mpi
- linux-6.1.128-mpi
- linux-6.1.129-mpi
- linux-6.1.130-mpi
- linux-6.1.131-mpi
- linux-6.1.132-mpi
- linux-6.1.133-mpi
- linux-6.1.134-mpi
- linux-6.1.135-mpi
- linux-6.1.136-mpi
- linux-6.1.137-mpi
- linux-6.1.138-mpi
- linux-6.1.139-mpi
- linux-6.1.140-mpi
- linux-6.1.141-mpi
- linux-6.1.142-mpi
- linux-6.1.143-mpi
- linux-6.1.144-mpi
- linux-6.1.145-mpi
- linux-6.1.146-mpi
- linux-6.1.147-mpi
- linux-6.1.73-mpi
- linux-6.1.74-mpi
- linux-6.1.75-mpi
- linux-6.1.76-mpi
- linux-6.1.77-mpi
- linux-6.1.78-mpi
- linux-6.1.79-mpi
- linux-6.1.80-mpi
- linux-6.1.81-mpi
- linux-6.1.82-mpi
- linux-6.1.83-mpi
- linux-6.1.84-mpi
- linux-6.1.85-mpi
- linux-6.1.86-mpi
- linux-6.1.87-mpi
- linux-6.1.88-mpi
- linux-6.1.89-mpi
- linux-6.1.90-mpi
- linux-6.1.91-mpi
- linux-6.1.92-mpi
- linux-6.1.93-mpi
- linux-6.1.94-mpi
- linux-6.1.95-mpi
- linux-6.1.96-mpi
- linux-6.1.97-mpi
- linux-6.1.98-mpi
- linux-6.1.99-mpi