netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4.15-rc8] net/core: Increase default optmem_max limit
@ 2018-01-15 23:59 Björn 'besser82' Esser
  2018-01-16  0:16 ` Björn 'besser82' Esser
  2018-01-16 14:30 ` David Miller
  0 siblings, 2 replies; 6+ messages in thread
From: Björn 'besser82' Esser @ 2018-01-15 23:59 UTC (permalink / raw)
  To: waltje, flla, A.Cox; +Cc: linux-kernel, netdev, trivial, labbott, zbyszek

With the new Linux Kernel Crypto API User Space Interface and
its underlying socket interface, the current default value for
`net.core.optmem_max` can be exhausted pretty quick.
On 32 bit systems it is not even enough for sending 16 IOVECs
at once to the socket interface.

To provide consumers of this new user space interface a
sufficient and reasonable maximum ancillary buffer size per
socket by default, the limit is increased to four times of the
previous setting:

  * 32 bit systems:  from 10240 bytes to 40960 bytes
  * 64 bit systems:  from 20480 bytes to 81920 bytes

This allows for sending 32/64 (32/64 bit) parallel IOVECs at
once to the socket interface, which should be enough for use
in real world applications.

Signed-off-by: Björn Esser <besser82@fedoraproject.org>
---

Index: linux-4.15/net/core/sock.c
===================================================================
--- linux-4.15.orig/net/core/sock.c
+++ linux-
4.15/net/core/sock.c
@@ -316,7 +316,7 @@ __u32 sysctl_wmem_default __read_mostly
 __u32 sysctl_rmem_default __read_mostly = SK_RMEM_MAX;
 
 /* Maximal
space eaten by iovec or ancillary data plus some space */
-int sysctl_optmem_max __read_mostly = sizeof(unsigned long)*(2*UIO_MAXIOV+512);
+int
sysctl_optmem_max __read_mostly = sizeof(unsigned long)*4*(2*UIO_MAXIOV+512);
 EXPORT_SYMBOL(sysctl_optmem_max);
 
 int sysctl_tstamp_allow_data
__read_mostly = 1;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 4.15-rc8] net/core: Increase default optmem_max limit
  2018-01-15 23:59 [PATCH 4.15-rc8] net/core: Increase default optmem_max limit Björn 'besser82' Esser
@ 2018-01-16  0:16 ` Björn 'besser82' Esser
  2018-01-16 14:30 ` David Miller
  1 sibling, 0 replies; 6+ messages in thread
From: Björn 'besser82' Esser @ 2018-01-16  0:16 UTC (permalink / raw)
  To: waltje, flla@stud.uni-sb.de, A.Cox@swansea.ac.uk
  Cc: linux-kernel, netdev, trivial, labbott, zbyszek

With the new Linux Kernel Crypto API User Space Interface and
its underlying socket interface, the current default value for
`net.core.optmem_max` can be exhausted pretty quick.
On 32 bit systems it is not even enough for sending 16 IOVECs
at once to the socket interface.

To provide consumers of this new user space interface a
sufficient and reasonable maximum ancillary buffer size per
socket by default, the limit is increased to four times of the
previous setting:

  * 32 bit systems:  from 10240 bytes to 40960 bytes
  * 64 bit systems:  from 20480 bytes to 81920 bytes

This allows for sending 32/64 (32/64 bit) parallel IOVECs at
once to the socket interface, which should be enough for use
in real world applications.

Signed-off-by: Björn Esser <besser82@fedoraproject.org>
---

Index: linux-4.15/net/core/sock.c
===================================================================
--- linux-4.15.orig/net/core/sock.c
+++ linux-4.15/net/core/sock.c
@@ -316,7 +316,7 @@ __u32 sysctl_wmem_default __read_mostly
 __u32 sysctl_rmem_default __read_mostly = SK_RMEM_MAX;
 
 /* Maximal space eaten by iovec or ancillary data plus some space */
-int sysctl_optmem_max __read_mostly = sizeof(unsigned long)*(2*UIO_MAXIOV+512);
+int sysctl_optmem_max __read_mostly = sizeof(unsigned long)*4*(2*UIO_MAXIOV+512);
 EXPORT_SYMBOL(sysctl_optmem_max);
 
 int sysctl_tstamp_allow_data __read_mostly = 1;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 4.15-rc8] net/core: Increase default optmem_max limit
  2018-01-15 23:59 [PATCH 4.15-rc8] net/core: Increase default optmem_max limit Björn 'besser82' Esser
  2018-01-16  0:16 ` Björn 'besser82' Esser
@ 2018-01-16 14:30 ` David Miller
  2018-01-16 17:13   ` [PATCH v2] " Björn 'besser82' Esser
  1 sibling, 1 reply; 6+ messages in thread
From: David Miller @ 2018-01-16 14:30 UTC (permalink / raw)
  To: besser82
  Cc: waltje, flla, A.Cox, linux-kernel, netdev, trivial, labbott,
	zbyszek

From: Björn 'besser82' Esser <besser82@fedoraproject.org>
Date: Tue, 16 Jan 2018 00:59:11 +0100

> @@ -316,7 +316,7 @@ __u32 sysctl_wmem_default __read_mostly
>  __u32 sysctl_rmem_default __read_mostly = SK_RMEM_MAX;
>  
>  /* Maximal
> space eaten by iovec or ancillary data plus some space */


This patch is corrupted by your email client, it has chopped up long
lines and turned TABs into a series of SPACE characters.

> -int sysctl_optmem_max __read_mostly = sizeof(unsigned long)*(2*UIO_MAXIOV+512);
> +int
> sysctl_optmem_max __read_mostly = sizeof(unsigned long)*4*(2*UIO_MAXIOV+512);
>  EXPORT_SYMBOL(sysctl_optmem_max);

Please style this in a more appropriate manner.

Thank you.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2] net/core: Increase default optmem_max limit
  2018-01-16 14:30 ` David Miller
@ 2018-01-16 17:13   ` Björn 'besser82' Esser
  2018-01-16 17:16     ` Björn 'besser82' Esser
  0 siblings, 1 reply; 6+ messages in thread
From: Björn 'besser82' Esser @ 2018-01-16 17:13 UTC (permalink / raw)
  To: David Miller
  Cc: waltje, flla, A.Cox, linux-kernel, netdev, trivial, labbott,
	zbyszek, Stephan Mueller, linux-crypto



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] net/core: Increase default optmem_max limit
  2018-01-16 17:13   ` [PATCH v2] " Björn 'besser82' Esser
@ 2018-01-16 17:16     ` Björn 'besser82' Esser
  2018-01-16 18:11       ` Stephan Mueller
  0 siblings, 1 reply; 6+ messages in thread
From: Björn 'besser82' Esser @ 2018-01-16 17:16 UTC (permalink / raw)
  To: David Miller
  Cc: waltje, flla, A.Cox, linux-kernel, netdev, trivial, labbott,
	zbyszek, Stephan Mueller, linux-crypto

With the new Linux Kernel Crypto API User Space Interface
and its underlying AF_ALG socket, the current default value
for `net.core.optmem_max` can be exhausted pretty quick when
using asynchronous IO; on 32 bit systems it is not even enough
for sending about 10 IOVECs at once to the socket interface.

To provide consumers of this new user space interface a well
sufficient and reasonable maximum ancillary buffer size per
socket by default, the limit is increased to four times of
the previous setting:

  * 32 bit systems:  from 10240 bytes to 40960 bytes
  * 64 bit systems:  from 20480 bytes to 81920 bytes

This allows for sending 32/64 (32/64 bit) parallel IOVECs at
once to the socket interface, which should be enough for use
in real world applications.

Signed-off-by: Björn Esser <besser82@fedoraproject.org>
---
 net/core/sock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/sock.c b/net/core/sock.c
index c0b5b2f17412..de00c571c933 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -316,7 +316,7 @@ __u32 sysctl_wmem_default __read_mostly = SK_WMEM_MAX;
 __u32 sysctl_rmem_default __read_mostly = SK_RMEM_MAX;
 
 /* Maximal space eaten by iovec or ancillary data plus some space */
-int sysctl_optmem_max __read_mostly = sizeof(unsigned long)*(2*UIO_MAXIOV+512);
+int sysctl_optmem_max __read_mostly = sizeof(unsigned long)*4*(2*UIO_MAXIOV+512);
 EXPORT_SYMBOL(sysctl_optmem_max);
 
 int sysctl_tstamp_allow_data __read_mostly = 1;

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] net/core: Increase default optmem_max limit
  2018-01-16 17:16     ` Björn 'besser82' Esser
@ 2018-01-16 18:11       ` Stephan Mueller
  0 siblings, 0 replies; 6+ messages in thread
From: Stephan Mueller @ 2018-01-16 18:11 UTC (permalink / raw)
  To: Björn 'besser82' Esser
  Cc: David Miller, waltje, flla, A.Cox, linux-kernel, netdev, trivial,
	labbott, zbyszek, linux-crypto

Am Dienstag, 16. Januar 2018, 18:16:43 CET schrieb Björn 'besser82' Esser:

Hi Björn,

> With the new Linux Kernel Crypto API User Space Interface
> and its underlying AF_ALG socket, the current default value
> for `net.core.optmem_max` can be exhausted pretty quick when
> using asynchronous IO; on 32 bit systems it is not even enough
> for sending about 10 IOVECs at once to the socket interface.
> 
> To provide consumers of this new user space interface a well
> sufficient and reasonable maximum ancillary buffer size per
> socket by default, the limit is increased to four times of
> the previous setting:
> 
>   * 32 bit systems:  from 10240 bytes to 40960 bytes
>   * 64 bit systems:  from 20480 bytes to 81920 bytes
> 
> This allows for sending 32/64 (32/64 bit) parallel IOVECs at
> once to the socket interface, which should be enough for use
> in real world applications.
> 
> Signed-off-by: Björn Esser <besser82@fedoraproject.org>

Considering NR_FILE defining the default maximum number of file descriptors, 
at max 335 MB of RAM (32 bit) or 670 MB (64 bit) could be allocated which I 
would assume to be ok in current systems.

Reviewed-by: Stephan Mueller <smueller@chronox.de>

Ciao
Stephan

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-01-16 18:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-15 23:59 [PATCH 4.15-rc8] net/core: Increase default optmem_max limit Björn 'besser82' Esser
2018-01-16  0:16 ` Björn 'besser82' Esser
2018-01-16 14:30 ` David Miller
2018-01-16 17:13   ` [PATCH v2] " Björn 'besser82' Esser
2018-01-16 17:16     ` Björn 'besser82' Esser
2018-01-16 18:11       ` Stephan Mueller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).