mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 06:44:00 -04:00
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>
This commit is contained in:
committed by
Jakub Kicinski
parent
2a2e6e5375
commit
a6d4f25888
@@ -222,6 +222,8 @@ rmem_max
|
|||||||
|
|
||||||
The maximum receive socket buffer size in bytes.
|
The maximum receive socket buffer size in bytes.
|
||||||
|
|
||||||
|
Default: 4194304
|
||||||
|
|
||||||
rps_default_mask
|
rps_default_mask
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
@@ -247,6 +249,8 @@ wmem_max
|
|||||||
|
|
||||||
The maximum send socket buffer size in bytes.
|
The maximum send socket buffer size in bytes.
|
||||||
|
|
||||||
|
Default: 4194304
|
||||||
|
|
||||||
message_burst and message_cost
|
message_burst and message_cost
|
||||||
------------------------------
|
------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ neigh/default/unres_qlen_bytes - INTEGER
|
|||||||
|
|
||||||
Setting negative value is meaningless and will return error.
|
Setting negative value is meaningless and will return error.
|
||||||
|
|
||||||
Default: SK_WMEM_MAX, (same as net.core.wmem_default).
|
Default: SK_WMEM_DEFAULT, (same as net.core.wmem_default).
|
||||||
|
|
||||||
Exact value depends on architecture and kernel options,
|
Exact value depends on architecture and kernel options,
|
||||||
but should be enough to allow queuing 256 packets
|
but should be enough to allow queuing 256 packets
|
||||||
@@ -805,8 +805,8 @@ tcp_rmem - vector of 3 INTEGERs: min, default, max
|
|||||||
This value results in initial window of 65535.
|
This value results in initial window of 65535.
|
||||||
|
|
||||||
max: maximal size of receive buffer allowed for automatically
|
max: maximal size of receive buffer allowed for automatically
|
||||||
selected receiver buffers for TCP socket. This value does not override
|
selected receiver buffers for TCP socket.
|
||||||
net.core.rmem_max. Calling setsockopt() with SO_RCVBUF disables
|
Calling setsockopt() with SO_RCVBUF disables
|
||||||
automatic tuning of that socket's receive buffer size, in which
|
automatic tuning of that socket's receive buffer size, in which
|
||||||
case this value is ignored.
|
case this value is ignored.
|
||||||
Default: between 131072 and 32MB, depending on RAM size.
|
Default: between 131072 and 32MB, depending on RAM size.
|
||||||
|
|||||||
@@ -2970,8 +2970,8 @@ void sk_get_meminfo(const struct sock *sk, u32 *meminfo);
|
|||||||
*/
|
*/
|
||||||
#define _SK_MEM_PACKETS 256
|
#define _SK_MEM_PACKETS 256
|
||||||
#define _SK_MEM_OVERHEAD SKB_TRUESIZE(256)
|
#define _SK_MEM_OVERHEAD SKB_TRUESIZE(256)
|
||||||
#define SK_WMEM_MAX (_SK_MEM_OVERHEAD * _SK_MEM_PACKETS)
|
#define SK_WMEM_DEFAULT (_SK_MEM_OVERHEAD * _SK_MEM_PACKETS)
|
||||||
#define SK_RMEM_MAX (_SK_MEM_OVERHEAD * _SK_MEM_PACKETS)
|
#define SK_RMEM_DEFAULT (_SK_MEM_OVERHEAD * _SK_MEM_PACKETS)
|
||||||
|
|
||||||
extern __u32 sysctl_wmem_max;
|
extern __u32 sysctl_wmem_max;
|
||||||
extern __u32 sysctl_rmem_max;
|
extern __u32 sysctl_rmem_max;
|
||||||
|
|||||||
@@ -281,12 +281,12 @@ static struct lock_class_key af_elock_keys[AF_MAX];
|
|||||||
static struct lock_class_key af_kern_callback_keys[AF_MAX];
|
static struct lock_class_key af_kern_callback_keys[AF_MAX];
|
||||||
|
|
||||||
/* Run time adjustable parameters. */
|
/* Run time adjustable parameters. */
|
||||||
__u32 sysctl_wmem_max __read_mostly = SK_WMEM_MAX;
|
__u32 sysctl_wmem_max __read_mostly = 4 << 20;
|
||||||
EXPORT_SYMBOL(sysctl_wmem_max);
|
EXPORT_SYMBOL(sysctl_wmem_max);
|
||||||
__u32 sysctl_rmem_max __read_mostly = SK_RMEM_MAX;
|
__u32 sysctl_rmem_max __read_mostly = 4 << 20;
|
||||||
EXPORT_SYMBOL(sysctl_rmem_max);
|
EXPORT_SYMBOL(sysctl_rmem_max);
|
||||||
__u32 sysctl_wmem_default __read_mostly = SK_WMEM_MAX;
|
__u32 sysctl_wmem_default __read_mostly = SK_WMEM_DEFAULT;
|
||||||
__u32 sysctl_rmem_default __read_mostly = SK_RMEM_MAX;
|
__u32 sysctl_rmem_default __read_mostly = SK_RMEM_DEFAULT;
|
||||||
|
|
||||||
DEFINE_STATIC_KEY_FALSE(memalloc_socks_key);
|
DEFINE_STATIC_KEY_FALSE(memalloc_socks_key);
|
||||||
EXPORT_SYMBOL_GPL(memalloc_socks_key);
|
EXPORT_SYMBOL_GPL(memalloc_socks_key);
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ struct neigh_table arp_tbl = {
|
|||||||
[NEIGH_VAR_DELAY_PROBE_TIME] = 5 * HZ,
|
[NEIGH_VAR_DELAY_PROBE_TIME] = 5 * HZ,
|
||||||
[NEIGH_VAR_INTERVAL_PROBE_TIME_MS] = 5 * HZ,
|
[NEIGH_VAR_INTERVAL_PROBE_TIME_MS] = 5 * HZ,
|
||||||
[NEIGH_VAR_GC_STALETIME] = 60 * HZ,
|
[NEIGH_VAR_GC_STALETIME] = 60 * HZ,
|
||||||
[NEIGH_VAR_QUEUE_LEN_BYTES] = SK_WMEM_MAX,
|
[NEIGH_VAR_QUEUE_LEN_BYTES] = SK_WMEM_DEFAULT,
|
||||||
[NEIGH_VAR_PROXY_QLEN] = 64,
|
[NEIGH_VAR_PROXY_QLEN] = 64,
|
||||||
[NEIGH_VAR_ANYCAST_DELAY] = 1 * HZ,
|
[NEIGH_VAR_ANYCAST_DELAY] = 1 * HZ,
|
||||||
[NEIGH_VAR_PROXY_DELAY] = (8 * HZ) / 10,
|
[NEIGH_VAR_PROXY_DELAY] = (8 * HZ) / 10,
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ struct neigh_table nd_tbl = {
|
|||||||
[NEIGH_VAR_DELAY_PROBE_TIME] = 5 * HZ,
|
[NEIGH_VAR_DELAY_PROBE_TIME] = 5 * HZ,
|
||||||
[NEIGH_VAR_INTERVAL_PROBE_TIME_MS] = 5 * HZ,
|
[NEIGH_VAR_INTERVAL_PROBE_TIME_MS] = 5 * HZ,
|
||||||
[NEIGH_VAR_GC_STALETIME] = 60 * HZ,
|
[NEIGH_VAR_GC_STALETIME] = 60 * HZ,
|
||||||
[NEIGH_VAR_QUEUE_LEN_BYTES] = SK_WMEM_MAX,
|
[NEIGH_VAR_QUEUE_LEN_BYTES] = SK_WMEM_DEFAULT,
|
||||||
[NEIGH_VAR_PROXY_QLEN] = 64,
|
[NEIGH_VAR_PROXY_QLEN] = 64,
|
||||||
[NEIGH_VAR_ANYCAST_DELAY] = 1 * HZ,
|
[NEIGH_VAR_ANYCAST_DELAY] = 1 * HZ,
|
||||||
[NEIGH_VAR_PROXY_DELAY] = (8 * HZ) / 10,
|
[NEIGH_VAR_PROXY_DELAY] = (8 * HZ) / 10,
|
||||||
|
|||||||
Reference in New Issue
Block a user