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

net: increase optmem_max default value

For many years, /proc/sys/net/core/optmem_max default value
on a 64bit kernel has been 20 KB.

Regular usage of TCP tx zerocopy needs a bit more.

Google has used 128KB as the default value for 7 years without
any problem.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Willem de Bruijn <willemb@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>

authored by

Eric Dumazet and committed by
David S. Miller
49445667 e16064c9

+8 -3
+4 -1
Documentation/admin-guide/sysctl/net.rst
··· 345 345 ---------- 346 346 347 347 Maximum ancillary buffer size allowed per socket. Ancillary data is a sequence 348 - of struct cmsghdr structures with appended data. 348 + of struct cmsghdr structures with appended data. TCP tx zerocopy also uses 349 + optmem_max as a limit for its internal structures. 350 + 351 + Default : 128 KB 349 352 350 353 fb_tunnels_only_for_init_net 351 354 ----------------------------
+4 -2
net/core/sock.c
··· 283 283 __u32 sysctl_wmem_default __read_mostly = SK_WMEM_MAX; 284 284 __u32 sysctl_rmem_default __read_mostly = SK_RMEM_MAX; 285 285 286 - /* Maximal space eaten by iovec or ancillary data plus some space */ 287 - int sysctl_optmem_max __read_mostly = sizeof(unsigned long)*(2*UIO_MAXIOV+512); 286 + /* Limits per socket sk_omem_alloc usage. 287 + * TCP zerocopy regular usage needs 128 KB. 288 + */ 289 + int sysctl_optmem_max __read_mostly = 128 * 1024; 288 290 EXPORT_SYMBOL(sysctl_optmem_max); 289 291 290 292 int sysctl_tstamp_allow_data __read_mostly = 1;