[PATCH v3 2/2] net/sctp: Replace in/out stream arrays with flex_array

2018-08-10 Thread Konstantin Khorenko
This path replaces physically contiguous memory arrays allocated using kmalloc_array() with flexible arrays. This enables to avoid memory allocation failures on the systems under a memory stress. Signed-off-by: Oleg Babin Signed-off-by: Konstantin Khorenko --- include/net/sctp/structs.h | 9

[PATCH v3 0/2] net/sctp: Avoid allocating high order memory with kmalloc()

2018-08-10 Thread Konstantin Khorenko
Each SCTP association can have up to 65535 input and output streams. For each stream type an array of sctp_stream_in or sctp_stream_out structures is allocated using kmalloc_array() function. This function allocates physically contiguous memory regions, so this can lead to allocation of memory

[PATCH v3 1/2] net/sctp: Make wrappers for accessing in/out streams

2018-08-10 Thread Konstantin Khorenko
-by: Konstantin Khorenko --- v2 changes: sctp_stream_in() users are updated to provide stream as an argument, sctp_stream_{in,out}_ptr() are now just sctp_stream_{in,out}(). v3 changes: Move type chages struct sctp_stream_out -> flex_array to next patch. Make sctp_stream_{in,out}() sta

Re: [PATCH v2 0/2] net/sctp: Avoid allocating high order memory with kmalloc()

2018-08-10 Thread Konstantin Khorenko
On 08/09/2018 11:43 AM, Konstantin Khorenko wrote: On 08/04/2018 02:36 AM, Marcelo Ricardo Leitner wrote: On Fri, Aug 03, 2018 at 07:21:00PM +0300, Konstantin Khorenko wrote: ... Performance results: * Kernel: v4.18-rc6 - stock and with 2 patches from Oleg (earlier

Re: [PATCH v2 0/2] net/sctp: Avoid allocating high order memory with kmalloc()

2018-08-09 Thread Konstantin Khorenko
On 08/04/2018 02:36 AM, Marcelo Ricardo Leitner wrote: On Fri, Aug 03, 2018 at 07:21:00PM +0300, Konstantin Khorenko wrote: ... Performance results: * Kernel: v4.18-rc6 - stock and with 2 patches from Oleg (earlier in this thread) * Node: CPU (8 cores): Intel(R) Xeon(R

Re: [PATCH v2 1/2] net/sctp: Make wrappers for accessing in/out streams

2018-08-09 Thread Konstantin Khorenko
On 08/03/2018 11:40 PM, Marcelo Ricardo Leitner wrote: On Fri, Aug 03, 2018 at 07:21:01PM +0300, Konstantin Khorenko wrote: This patch introduces wrappers for accessing in/out streams indirectly. This will enable to replace physically contiguous memory arrays of streams with flexible arrays

Re: [PATCH v2 1/2] net/sctp: Make wrappers for accessing in/out streams

2018-08-09 Thread Konstantin Khorenko
On 08/03/2018 10:50 PM, David Miller wrote: From: Konstantin Khorenko Date: Fri, 3 Aug 2018 19:21:01 +0300 +struct sctp_stream_out *sctp_stream_out(const struct sctp_stream *stream, + __u16 sid) +{ + return ((struct sctp_stream_out *)(stream->

[PATCH v2 1/2] net/sctp: Make wrappers for accessing in/out streams

2018-08-03 Thread Konstantin Khorenko
-by: Konstantin Khorenko --- v2 changes: sctp_stream_in() users are updated to provide stream as an argument, sctp_stream_{in,out}_ptr() are now just sctp_stream_{in,out}(). --- include/net/sctp/structs.h | 30 +++- net/sctp/chunk.c | 6 ++- net/sctp/outqueue.c

[PATCH v2 2/2] net/sctp: Replace in/out stream arrays with flex_array

2018-08-03 Thread Konstantin Khorenko
This path replaces physically contiguous memory arrays allocated using kmalloc_array() with flexible arrays. This enables to avoid memory allocation failures on the systems under a memory stress. Signed-off-by: Oleg Babin --- include/net/sctp/structs.h | 1 + net/sctp/stream.c | 78

[PATCH v2 0/2] net/sctp: Avoid allocating high order memory with kmalloc()

2018-08-03 Thread Konstantin Khorenko
Each SCTP association can have up to 65535 input and output streams. For each stream type an array of sctp_stream_in or sctp_stream_out structures is allocated using kmalloc_array() function. This function allocates physically contiguous memory regions, so this can lead to allocation of memory

Re: [PATCH net-next 0/2] net/sctp: Avoid allocating high order memory with kmalloc()

2018-07-24 Thread Konstantin Khorenko
On 04/27/2018 01:28 AM, Marcelo Ricardo Leitner wrote: > On Fri, Apr 27, 2018 at 01:14:56AM +0300, Oleg Babin wrote: >> Hi Marcelo, >> >> On 04/24/2018 12:33 AM, Marcelo Ricardo Leitner wrote: >>> Hi, >>> >>> On Mon, Apr 23, 2018 at 09:41:04PM +0300, Oleg Babin wrote: Each SCTP association