Jon Maxwell
af6d10345c
ipv6: remove max_size check inline with ipv4
...
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>
2023-01-13 20:59:14 -08:00
..
2023-01-12 17:02:20 -06:00
2022-12-25 13:38:09 -08:00
2022-10-28 20:13:54 -07:00
2022-11-24 17:12:15 +01:00
2022-11-16 13:31:03 +00:00
2022-12-13 15:47:48 -08:00
2022-12-13 15:47:48 -08:00
2022-12-17 14:06:53 -06:00
2022-12-25 13:38:09 -08:00
2023-01-13 20:44:20 -08:00
2022-12-13 15:47:48 -08:00
2022-12-19 17:28:49 -08:00
2023-01-13 20:59:14 -08:00
2022-11-15 15:27:43 +01:00
2022-11-29 13:04:52 -08:00
2023-01-11 20:49:32 -08:00
2022-11-01 10:04:52 -07:00
2023-01-13 08:40:41 +00:00
2022-12-07 20:02:44 -08:00
2023-01-13 10:23:52 +00:00
2022-12-01 20:26:22 -08:00
2022-12-07 17:33:26 -08:00
2023-01-05 12:40:50 -08:00
2023-01-13 20:59:14 -08:00
2022-11-15 12:42:26 +01:00
2022-11-29 20:50:51 -08:00
2022-11-29 13:04:52 -08:00
2022-12-25 13:38:09 -08:00
2022-12-08 18:19:59 -08:00
2022-12-19 17:20:22 -08:00
2022-10-28 20:13:54 -07:00
2023-01-09 07:30:50 +00:00
2022-12-06 17:29:14 -08:00
2023-01-05 22:13:39 -08:00
2022-12-13 15:47:48 -08:00
2022-12-26 09:09:23 +00:00
2022-12-21 17:48:12 -08:00
2022-12-13 15:47:48 -08:00
2022-11-04 10:09:50 +00:00
2022-11-24 17:12:15 +01:00
2022-11-02 11:57:30 +00:00
2023-01-07 09:30:26 +00:00
2023-01-10 18:19:32 -08:00
2022-12-13 15:47:48 -08:00
2022-11-25 13:01:55 -05:00
2023-01-10 15:03:06 -06:00
2023-01-06 12:53:10 +00:00
2022-12-13 15:47:48 -08:00
2022-12-15 11:35:18 +01:00
2023-01-12 12:53:54 +01:00
2022-12-16 03:54:54 -08:00
2022-11-15 20:22:19 -08:00
2022-11-15 09:00:27 -08:00
2022-12-19 17:28:49 -08:00
2022-11-25 13:01:55 -05:00
2022-09-20 14:23:56 -07:00
2023-01-05 22:12:00 -08:00
2023-01-13 10:25:10 +00:00