Jon Maxwell
584756c3d7
ipv6: remove max_size check inline with ipv4
...
commit af6d10345ca76670c1b7c37799f0d5576ccef277 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>
Signed-off-by: Suraj Jitindar Singh <surajjs@amazon.com>
Cc: <stable@vger.kernel.org> # 5.4.x
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-01-15 18:25:29 +01:00
..
2021-09-15 09:47:31 +02:00
2024-01-08 11:29:47 +01:00
2023-01-18 11:41:37 +01:00
2024-01-08 11:29:44 +01:00
2023-12-20 15:41:18 +01:00
2023-12-20 15:41:15 +01:00
2022-04-20 09:19:40 +02:00
2023-08-30 16:27:25 +02:00
2024-01-08 11:29:47 +01:00
2023-01-18 11:41:04 +01:00
2021-07-14 16:53:33 +02:00
2023-11-28 16:50:17 +00:00
2023-03-17 08:32:51 +01:00
2024-01-15 18:25:25 +01:00
2023-10-25 11:53:19 +02:00
2024-01-15 18:25:29 +01:00
2023-08-11 11:53:57 +02:00
2023-11-20 10:30:15 +01:00
2023-06-21 15:44:10 +02:00
2023-07-27 08:37:24 +02:00
2023-01-18 11:41:09 +01:00
2022-11-03 23:56:54 +09:00
2024-01-08 11:29:44 +01:00
2024-01-15 18:25:26 +01:00
2024-01-15 18:25:29 +01:00
2023-04-20 12:07:32 +02:00
2023-09-23 11:00:02 +02:00
2023-08-30 16:27:16 +02:00
2023-10-10 21:46:44 +02:00
2022-04-27 13:50:47 +02:00
2021-02-10 09:25:28 +01:00
2023-11-20 10:30:15 +01:00
2024-01-08 11:29:43 +01:00
2022-12-14 11:30:45 +01:00
2023-02-22 12:50:41 +01:00
2023-11-28 16:50:21 +00:00
2024-01-15 18:25:29 +01:00
2023-09-23 10:59:39 +02:00
2023-12-13 18:18:17 +01:00
2023-09-23 10:59:43 +02:00
2024-01-15 18:25:25 +01:00
2023-05-30 12:44:05 +01:00
2023-02-22 12:50:25 +01:00
2023-12-13 18:18:14 +01:00
2022-01-11 15:23:33 +01:00
2023-12-13 18:18:17 +01:00
2021-09-03 10:08:12 +02:00
2023-10-25 11:53:18 +02:00
2024-01-08 11:29:47 +01:00
2024-01-08 11:29:44 +01:00
2023-05-17 11:35:59 +02:00
2024-01-15 18:25:25 +01:00
2023-10-10 21:46:45 +02:00
2023-11-20 10:30:16 +01:00
2021-11-17 09:48:48 +01:00
2023-10-10 21:46:35 +02:00
2021-10-27 09:54:24 +02:00
2023-11-28 16:50:16 +00:00
2024-01-15 18:25:29 +01:00
2023-09-23 10:59:58 +02:00
2023-12-20 15:41:17 +01:00
2024-01-08 11:29:46 +01:00
2023-02-22 12:50:26 +01:00
2023-07-27 08:37:23 +02:00
2023-10-25 11:53:21 +02:00
2021-06-18 09:59:00 +02:00
2023-06-21 15:44:10 +02:00
2023-06-21 15:44:10 +02:00
2024-01-15 18:25:26 +01:00