BUG/MINOR: quic: do not allocate more rxbufs than necessary

When QUIC thread binding was fixed by commit f5a0c8abf ("MEDIUM: quic:
respect the threads assigned to a bind line"), one point was overlooked
regarding rxbuf allocation. Indeed, there's one rxbuf per listener and
per bound thread. Originally the loop would iterate over all threads,
but this is not needed anymore and causes lots of memory to be allocated
in scenarios where shards are used, the worst one being "shards by-thread"
which allocates N^2 buffers for N threads. This gives us 2304 buffers
(or 576 MB of RAM) for 48 threads!

Let's only allocate one buffer per bound thread on each listener to fix
this.

This should be backported to 2.7 and generally wherever the commit
above is backported. It depends on the previous commit below:
"BUG/MEDIUM: quic: properly take shards into account on bind lines"
This commit is contained in:
Willy Tarreau 2022-12-21 09:16:55 +01:00
parent eed7826529
commit 8d49253588

View File

@ -541,7 +541,7 @@ static int quic_alloc_rxbufs_listener(struct listener *l)
struct quic_receiver_buf *tmp; struct quic_receiver_buf *tmp;
MT_LIST_INIT(&l->rx.rxbuf_list); MT_LIST_INIT(&l->rx.rxbuf_list);
for (i = 0; i < global.nbthread; i++) { for (i = 0; i < my_popcountl(l->rx.bind_thread); i++) {
struct quic_receiver_buf *rxbuf; struct quic_receiver_buf *rxbuf;
char *buf; char *buf;