Jon Maxwell
95372b040a
ipv6: remove max_size check inline with ipv4
...
commit af6d10345c
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 > # 4.19.x
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2024-01-15 18:23:44 +01:00
..
2019-07-03 13:14:42 +02:00
2023-10-25 11:16:56 +02:00
2021-06-10 13:24:06 +02:00
2018-06-28 10:40:47 -07:00
2023-08-16 18:13:01 +02:00
2024-01-15 18:23:44 +01:00
2023-08-11 11:45:03 +02:00
2019-03-23 20:09:51 +01:00
2022-01-05 12:34:58 +01:00
2022-05-18 09:42:48 +02:00
2020-06-03 08:19:15 +02:00
2023-08-11 11:45:18 +02:00
2018-07-13 12:18:18 -04:00
2018-08-03 12:46:20 -07:00
2021-07-31 08:22:37 +02:00
2018-08-07 12:39:13 -07:00
2017-11-02 11:10:55 +01:00
2022-04-15 14:15:01 +02:00
2017-11-02 11:10:55 +01:00
2022-04-27 13:39:45 +02:00
2018-04-19 16:11:11 -04:00
2022-02-23 11:58:39 +01:00
2021-12-14 10:18:05 +01:00
2023-08-30 16:31:54 +02:00
2022-09-05 10:26:30 +02:00
2017-07-04 22:35:16 +01:00
2023-08-16 18:13:00 +02:00
2022-03-02 11:38:12 +01:00
2017-07-04 01:29:04 -07:00
2018-04-02 20:16:17 +02:00
2017-11-02 11:10:55 +01:00
2018-07-27 13:17:50 -07:00
2018-10-10 10:19:10 -07:00
2020-11-10 12:36:02 +01:00
2017-11-02 11:10:55 +01:00
2018-03-05 12:52:45 -05:00
2022-02-16 12:51:46 +01:00
2024-01-15 18:23:44 +01:00
2023-10-10 21:44:57 +02:00
2018-05-20 18:31:42 -04:00
2022-07-12 16:29:00 +02:00
2018-02-28 11:43:28 -05:00
2018-05-28 22:59:54 -04:00
2017-11-01 11:50:43 +09:00
2020-03-18 07:14:14 +01:00
2017-11-02 11:10:55 +01:00
2022-04-20 09:12:48 +02:00
2018-07-20 10:14:41 +02:00
2017-11-02 11:10:55 +01:00
2019-12-05 09:19:45 +01:00
2019-11-10 11:27:54 +01:00
2017-11-02 11:10:55 +01:00
2018-08-11 12:37:10 -07:00
2023-12-13 17:42:20 +01:00
2017-11-02 11:10:55 +01:00
2018-02-27 14:46:26 -05:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-12-11 14:10:06 -05:00
2017-11-02 11:10:55 +01:00
2021-03-04 09:39:59 +01:00
2018-06-15 14:04:00 +02:00
2022-10-26 13:19:42 +02:00
2022-06-14 16:59:14 +02:00
2018-04-22 21:12:00 -04:00
2017-08-07 11:39:22 -07:00
2018-06-26 11:33:04 +09:00
2021-04-07 12:48:47 +02:00
2020-07-22 09:32:00 +02:00
2019-04-27 09:36:33 +02:00
2022-06-06 08:24:20 +02:00
2022-07-29 17:10:31 +02:00
2018-06-05 10:45:24 -04:00
2019-02-23 09:07:24 +01:00
2022-02-08 18:23:09 +01:00
2021-08-12 13:19:39 +02:00
2023-05-30 12:42:10 +01:00
2019-01-31 08:14:32 +01:00
2023-05-30 12:42:10 +01:00
2020-08-19 08:14:56 +02:00
2023-06-09 10:23:54 +02:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2019-07-10 09:53:46 +02:00
2023-08-11 11:45:31 +02:00
2020-02-11 04:34:14 -08:00
2018-03-27 09:51:23 +02:00
2019-02-06 17:30:06 +01:00
2018-07-11 23:10:19 -07:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2017-10-25 12:06:25 +09:00
2019-11-06 13:06:23 +01:00
2021-08-04 12:23:46 +02:00
2021-11-26 11:36:16 +01:00
2023-09-23 10:48:01 +02:00
2018-06-18 22:40:32 +02:00
2017-11-02 11:10:55 +01:00
2023-01-18 11:30:36 +01:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2023-06-21 15:39:59 +02:00
2018-05-28 22:59:54 -04:00
2021-06-30 08:48:18 -04:00
2017-11-02 11:10:55 +01:00
2018-08-01 09:52:30 -07:00
2017-07-01 07:39:09 -07:00
2018-09-29 11:48:26 -07:00
2019-05-02 09:58:57 +02:00
2018-04-07 22:32:31 -04:00
2021-12-01 09:27:42 +01:00
2017-11-08 16:12:33 +09:00
2017-11-02 11:10:55 +01:00
2018-05-24 18:36:15 -07:00
2018-05-16 07:23:35 +02:00
2020-02-01 09:37:06 +00:00
2023-08-11 11:45:19 +02:00
2017-11-02 11:10:55 +01:00
2022-11-10 17:46:54 +01:00
2021-08-26 08:36:38 -04:00
2017-11-02 11:10:55 +01:00
2018-05-16 07:23:35 +02:00
2017-11-02 11:10:55 +01:00
2021-04-14 08:22:34 +02:00
2018-08-28 11:11:47 +02:00
2020-01-27 14:51:18 +01:00
2018-05-16 07:23:35 +02:00
2018-05-29 10:12:45 -04:00
2018-03-13 18:37:02 +02:00
2021-03-30 14:37:03 +02:00
2022-01-27 09:04:33 +01:00
2023-05-17 11:13:11 +02:00
2022-06-06 08:24:20 +02:00
2018-06-22 13:43:27 +09:00
2018-07-31 09:22:48 +02:00
2018-06-22 13:43:27 +09:00
2018-04-11 10:33:46 -04:00
2018-06-30 20:42:25 +09:00
2019-09-21 07:16:43 +02:00
2023-11-28 16:46:31 +00:00
2018-03-01 21:21:36 -05:00
2017-11-02 11:10:55 +01:00
2018-06-06 14:07:53 -04:00
2018-05-03 13:46:47 -04:00
2018-02-21 15:06:05 -05:00
2023-10-25 11:16:46 +02:00
2018-05-08 00:02:41 -04:00
2020-12-08 10:18:52 +01:00
2018-07-07 10:58:49 +09:00
2017-11-02 11:10:55 +01:00
2017-08-29 15:16:52 -07:00
2018-06-26 11:33:04 +09:00
2023-04-26 11:21:52 +02:00
2023-04-26 11:21:52 +02:00
2018-04-17 13:53:13 -04:00
2018-01-24 19:13:45 -05:00
2017-11-02 11:10:55 +01:00
2017-11-02 11:10:55 +01:00
2019-05-04 09:20:12 +02:00
2018-08-10 16:12:20 +02:00
2022-04-15 14:15:07 +02:00