From: David Laight <David.Laight@ACULAB.COM>
To: 'Marcelo Ricardo Leitner' <marcelo.leitner@gmail.com>
Cc: "'linux-sctp@vger.kernel.org'" <linux-sctp@vger.kernel.org>,
'Neil Horman' <nhorman@tuxdriver.com>,
"'kent.overstreet@gmail.com'" <kent.overstreet@gmail.com>,
'Andrew Morton' <akpm@linux-foundation.org>,
"'netdev@vger.kernel.org'" <netdev@vger.kernel.org>
Subject: RE: sctp: num_ostreams and max_instreams negotiation
Date: Tue, 18 Aug 2020 08:08:24 +0000 [thread overview]
Message-ID: <e438e08865a04eac92dde5ba8ce1dbf2@AcuMS.aculab.com> (raw)
In-Reply-To: <20200817143554.GI3399@localhost.localdomain>
From: Marcelo Ricardo Leitner
> Sent: 17 August 2020 15:36
..
> > The proper fix here is to move back to the original if() condition,
> > and put genradix_prealloc() inside it again, as was fa_zero() before.
> > The if() is not strictly needed, because genradix_prealloc() will
> > handle it nicely, but it's a nice-to-have optimization anyway.
> >
> > Do you want to send a patch?
I can, but my systems aren't really setup for doing it.
Especially while working from home.
Just deleting the conditionals works for normal connections.
I don't know what happens if the number of streams is negotiated
up and down (and up again?) while the connection is active.
> Note the thread 'Subject: RE: v5.3.12 SCTP Stream Negotiation Problem'
> though.
The patch you suggested contained a typo:
- if (incnt <= stream->incnt)
- return 0;
+ if (incnt > stream->incnt)
+ goto out;
So the 'in' array was never allocated.
The code will still allocate a 'big' array which I think used
to get shrunk when the value from the peer was processed.
I suspect the array need not get allocated until after
that is done (ISTR in process_init).
I also suspect that the genradix lookup is more expensive
than the sctp code expects.
I wonder if a straight forward kvmalloc() wouldn't be better.
You'd actually need kvrealloc().
All the sctp connections we use have a max of 17 streams.
But if someone allocates 64k and then uses them sparsely
it still allocates about 700 pages for the genradix arrays.
Also, since the 'gfp' flags are being passed in, I suspect
the allocate happens in atomic context somewhere.
I bet allocating 700 pages is very likely to fail!
Lazy allocation would only require single pages be allocated,
but would need extra error paths.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
prev parent reply other threads:[~2020-08-18 8:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-14 13:36 sctp: num_ostreams and max_instreams negotiation David Laight
2020-08-14 13:36 ` David Laight
2020-08-14 16:18 ` David Laight
2020-08-14 16:18 ` David Laight
2020-08-15 14:49 ` David Laight
2020-08-15 14:49 ` David Laight
2020-08-17 14:22 ` Marcelo Ricardo Leitner
2020-08-17 14:22 ` Marcelo Ricardo Leitner
2020-08-17 14:35 ` Marcelo Ricardo Leitner
2020-08-17 14:35 ` Marcelo Ricardo Leitner
2020-08-18 8:08 ` David Laight [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e438e08865a04eac92dde5ba8ce1dbf2@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=akpm@linux-foundation.org \
--cc=kent.overstreet@gmail.com \
--cc=linux-sctp@vger.kernel.org \
--cc=marcelo.leitner@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=nhorman@tuxdriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.