Skip to content

Commit 4944566

Browse files
edumazetdavem330
authored andcommitted
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 <[email protected]> Reviewed-by: Willem de Bruijn <[email protected]> Reviewed-by: Willem de Bruijn <[email protected]> Acked-by: Neal Cardwell <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent e16064c commit 4944566

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Documentation/admin-guide/sysctl/net.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,10 @@ optmem_max
345345
----------
346346

347347
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
349352

350353
fb_tunnels_only_for_init_net
351354
----------------------------

net/core/sock.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,10 @@ EXPORT_SYMBOL(sysctl_rmem_max);
283283
__u32 sysctl_wmem_default __read_mostly = SK_WMEM_MAX;
284284
__u32 sysctl_rmem_default __read_mostly = SK_RMEM_MAX;
285285

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;
288290
EXPORT_SYMBOL(sysctl_optmem_max);
289291

290292
int sysctl_tstamp_allow_data __read_mostly = 1;

0 commit comments

Comments
 (0)