diff options
author | Eric Dumazet <edumazet@google.com> | 2023-12-14 13:49:00 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2023-12-15 14:01:27 +0300 |
commit | f5769faeec36b9d5b9df2c3e4f05a76d04ffd9c9 (patch) | |
tree | 8bb17e49ba064927fcad5296337c099f323e3709 /net/core/net_namespace.c | |
parent | 4944566706b27918ca15eda913889db296792415 (diff) | |
download | linux-f5769faeec36b9d5b9df2c3e4f05a76d04ffd9c9.tar.xz |
net: Namespace-ify sysctl_optmem_max
optmem_max being used in tx zerocopy,
we want to be able to control it on a netns basis.
Following patch changes two tests.
Tested:
oqq130:~# cat /proc/sys/net/core/optmem_max
131072
oqq130:~# echo 1000000 >/proc/sys/net/core/optmem_max
oqq130:~# cat /proc/sys/net/core/optmem_max
1000000
oqq130:~# unshare -n
oqq130:~# cat /proc/sys/net/core/optmem_max
131072
oqq130:~# exit
logout
oqq130:~# cat /proc/sys/net/core/optmem_max
1000000
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/net_namespace.c')
-rw-r--r-- | net/core/net_namespace.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c index cb8bcbff9e83..72799533426b 100644 --- a/net/core/net_namespace.c +++ b/net/core/net_namespace.c @@ -372,6 +372,10 @@ out_undo: static int __net_init net_defaults_init_net(struct net *net) { net->core.sysctl_somaxconn = SOMAXCONN; + /* Limits per socket sk_omem_alloc usage. + * TCP zerocopy regular usage needs 128 KB. + */ + net->core.sysctl_optmem_max = 128 * 1024; net->core.sysctl_txrehash = SOCK_TXREHASH_ENABLED; return 0; |