From 0f495b3d87b063a98cb8ddc846d6510703e1d0ea Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Mon, 22 Mar 2021 14:41:38 +0100 Subject: [PATCH] MINOR: channel: simplify the channel's buffer allocation The channel's buffer allocator, channel_alloc_buffer(), was still relying on the principle of a margin for the request and not for the response. But this margin stopped working around 1.7 with the introduction of the content filters such as SPOE, and was completely anihilated with the local pools that came with threads. Let's simplify this and just use b_alloc(). --- include/haproxy/channel.h | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/include/haproxy/channel.h b/include/haproxy/channel.h index 296e465df..d37eec461 100644 --- a/include/haproxy/channel.h +++ b/include/haproxy/channel.h @@ -832,23 +832,15 @@ static inline int ci_space_for_replace(const struct channel *chn) return end - ci_tail(chn); } -/* Allocates a buffer for channel , but only if it's guaranteed that it's - * not the last available buffer or it's the response buffer. Unless the buffer - * is the response buffer, an extra control is made so that we always keep - * buffers available after this allocation. Returns 0 in - * case of failure, non-zero otherwise. +/* Allocates a buffer for channel . Returns 0 in case of failure, non-zero + * otherwise. * * If no buffer are available, the requester, represented by pointer, * will be added in the list of objects waiting for an available buffer. */ static inline int channel_alloc_buffer(struct channel *chn, struct buffer_wait *wait) { - int margin = 0; - - if (!(chn->flags & CF_ISRESP)) - margin = global.tune.reserved_bufs; - - if (b_alloc_margin(&chn->buf, margin) != NULL) + if (b_alloc(&chn->buf) != NULL) return 1; if (!LIST_ADDED(&wait->list))