MEDIUM: mux-h1: allocate without queuing when retrying

Now when trying to allocate a buffer, we can check if we've been notified
of availability via the callback, in which case we should not consult the
queue, or if we're doing a first allocation and check the queue. At this
point it still doesn't change much since the stream still doesn't make use
of it but some progress is expected.
This commit is contained in:
Willy Tarreau 2024-05-07 17:36:13 +02:00
parent 5b8d27617f
commit 47665be083

View File

@ -539,7 +539,8 @@ static inline struct buffer *h1_get_ibuf(struct h1c *h1c)
{
struct buffer *buf;
if (unlikely((buf = b_alloc(&h1c->ibuf, DB_MUX_RX)) == NULL)) {
if (unlikely((buf = b_alloc(&h1c->ibuf, DB_MUX_RX |
((h1c->flags & H1C_F_IN_MAYALLOC) ? DB_F_NOQUEUE : 0))) == NULL)) {
b_queue(DB_MUX_RX, &h1c->buf_wait, h1c, h1_buf_available);
h1c->flags |= H1C_F_IN_ALLOC;
}
@ -557,7 +558,8 @@ static inline struct buffer *h1_get_obuf(struct h1c *h1c)
{
struct buffer *buf;
if (unlikely((buf = b_alloc(&h1c->obuf, DB_MUX_TX)) == NULL)) {
if (unlikely((buf = b_alloc(&h1c->obuf, DB_MUX_TX |
((h1c->flags & H1C_F_OUT_MAYALLOC) ? DB_F_NOQUEUE : 0))) == NULL)) {
b_queue(DB_MUX_TX, &h1c->buf_wait, h1c, h1_buf_available);
h1c->flags |= H1C_F_OUT_ALLOC;
}
@ -576,7 +578,8 @@ static inline struct buffer *h1_get_rxbuf(struct h1s *h1s)
struct h1c *h1c = h1s->h1c;
struct buffer *buf;
if (unlikely((buf = b_alloc(&h1s->rxbuf, DB_SE_RX)) == NULL)) {
if (unlikely((buf = b_alloc(&h1s->rxbuf, DB_SE_RX |
((h1c->flags & H1C_F_IN_SMAYALLOC) ? DB_F_NOQUEUE : 0))) == NULL)) {
b_queue(DB_SE_RX, &h1c->buf_wait, h1c, h1_buf_available);
h1c->flags |= H1C_F_IN_SALLOC;
}