Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: set net.core.rmem_max and net.core.wmem_max to 4 MB

SO_RCVBUF and SO_SNDBUF have limited range today, unless
distros or system admins change rmem_max and wmem_max.

Even iproute2 uses 1 MB SO_RCVBUF which is capped by
the kernel.

Decouple [rw]mem_max and [rw]mem_default and increase
[rw]mem_max to 4 MB.

Before:

$ sysctl net.core.rmem_default net.core.rmem_max net.core.wmem_default net.core.wmem_max
net.core.rmem_default = 212992
net.core.rmem_max = 212992
net.core.wmem_default = 212992
net.core.wmem_max = 212992

After:

$ sysctl net.core.rmem_default net.core.rmem_max net.core.wmem_default net.core.wmem_max
net.core.rmem_default = 212992
net.core.rmem_max = 4194304
net.core.wmem_default = 212992
net.core.wmem_max = 4194304

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Neal Cardwell <ncardwell@google.com>
Link: https://patch.msgid.link/20250819174030.1986278-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Eric Dumazet and committed by
Jakub Kicinski
a6d4f258 2a2e6e53

+15 -11
+4
Documentation/admin-guide/sysctl/net.rst
··· 222 222 223 223 The maximum receive socket buffer size in bytes. 224 224 225 + Default: 4194304 226 + 225 227 rps_default_mask 226 228 ---------------- 227 229 ··· 248 246 -------- 249 247 250 248 The maximum send socket buffer size in bytes. 249 + 250 + Default: 4194304 251 251 252 252 message_burst and message_cost 253 253 ------------------------------
+3 -3
Documentation/networking/ip-sysctl.rst
··· 209 209 210 210 Setting negative value is meaningless and will return error. 211 211 212 - Default: SK_WMEM_MAX, (same as net.core.wmem_default). 212 + Default: SK_WMEM_DEFAULT, (same as net.core.wmem_default). 213 213 214 214 Exact value depends on architecture and kernel options, 215 215 but should be enough to allow queuing 256 packets ··· 805 805 This value results in initial window of 65535. 806 806 807 807 max: maximal size of receive buffer allowed for automatically 808 - selected receiver buffers for TCP socket. This value does not override 809 - net.core.rmem_max. Calling setsockopt() with SO_RCVBUF disables 808 + selected receiver buffers for TCP socket. 809 + Calling setsockopt() with SO_RCVBUF disables 810 810 automatic tuning of that socket's receive buffer size, in which 811 811 case this value is ignored. 812 812 Default: between 131072 and 32MB, depending on RAM size.
+2 -2
include/net/sock.h
··· 2970 2970 */ 2971 2971 #define _SK_MEM_PACKETS 256 2972 2972 #define _SK_MEM_OVERHEAD SKB_TRUESIZE(256) 2973 - #define SK_WMEM_MAX (_SK_MEM_OVERHEAD * _SK_MEM_PACKETS) 2974 - #define SK_RMEM_MAX (_SK_MEM_OVERHEAD * _SK_MEM_PACKETS) 2973 + #define SK_WMEM_DEFAULT (_SK_MEM_OVERHEAD * _SK_MEM_PACKETS) 2974 + #define SK_RMEM_DEFAULT (_SK_MEM_OVERHEAD * _SK_MEM_PACKETS) 2975 2975 2976 2976 extern __u32 sysctl_wmem_max; 2977 2977 extern __u32 sysctl_rmem_max;
+4 -4
net/core/sock.c
··· 281 281 static struct lock_class_key af_kern_callback_keys[AF_MAX]; 282 282 283 283 /* Run time adjustable parameters. */ 284 - __u32 sysctl_wmem_max __read_mostly = SK_WMEM_MAX; 284 + __u32 sysctl_wmem_max __read_mostly = 4 << 20; 285 285 EXPORT_SYMBOL(sysctl_wmem_max); 286 - __u32 sysctl_rmem_max __read_mostly = SK_RMEM_MAX; 286 + __u32 sysctl_rmem_max __read_mostly = 4 << 20; 287 287 EXPORT_SYMBOL(sysctl_rmem_max); 288 - __u32 sysctl_wmem_default __read_mostly = SK_WMEM_MAX; 289 - __u32 sysctl_rmem_default __read_mostly = SK_RMEM_MAX; 288 + __u32 sysctl_wmem_default __read_mostly = SK_WMEM_DEFAULT; 289 + __u32 sysctl_rmem_default __read_mostly = SK_RMEM_DEFAULT; 290 290 291 291 DEFINE_STATIC_KEY_FALSE(memalloc_socks_key); 292 292 EXPORT_SYMBOL_GPL(memalloc_socks_key);
+1 -1
net/ipv4/arp.c
··· 170 170 [NEIGH_VAR_DELAY_PROBE_TIME] = 5 * HZ, 171 171 [NEIGH_VAR_INTERVAL_PROBE_TIME_MS] = 5 * HZ, 172 172 [NEIGH_VAR_GC_STALETIME] = 60 * HZ, 173 - [NEIGH_VAR_QUEUE_LEN_BYTES] = SK_WMEM_MAX, 173 + [NEIGH_VAR_QUEUE_LEN_BYTES] = SK_WMEM_DEFAULT, 174 174 [NEIGH_VAR_PROXY_QLEN] = 64, 175 175 [NEIGH_VAR_ANYCAST_DELAY] = 1 * HZ, 176 176 [NEIGH_VAR_PROXY_DELAY] = (8 * HZ) / 10,
+1 -1
net/ipv6/ndisc.c
··· 130 130 [NEIGH_VAR_DELAY_PROBE_TIME] = 5 * HZ, 131 131 [NEIGH_VAR_INTERVAL_PROBE_TIME_MS] = 5 * HZ, 132 132 [NEIGH_VAR_GC_STALETIME] = 60 * HZ, 133 - [NEIGH_VAR_QUEUE_LEN_BYTES] = SK_WMEM_MAX, 133 + [NEIGH_VAR_QUEUE_LEN_BYTES] = SK_WMEM_DEFAULT, 134 134 [NEIGH_VAR_PROXY_QLEN] = 64, 135 135 [NEIGH_VAR_ANYCAST_DELAY] = 1 * HZ, 136 136 [NEIGH_VAR_PROXY_DELAY] = (8 * HZ) / 10,