mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-11-28 14:21:00 +01:00
MINOR: dynbuf: set POOL_F_NO_FAIL on buffer allocation
b_alloc() is used to allocate a buffer. We can provoke fault injection based on forced memory allocation failures using -dMfail on the command line, but we know that the buffer_wait list is a bit weak and doesn't always recover well. As such, submitting buffer allocation to such a treatment seriously limits the usefulness of -dMfail which cannot really be used for other purposes. Let's just disable it for buffers for now.
This commit is contained in:
parent
7a8ca0a063
commit
69869e6354
@ -58,7 +58,10 @@ static inline int buffer_almost_full(const struct buffer *buf)
|
|||||||
|
|
||||||
/* Ensures that <buf> is allocated, or allocates it. If no memory is available,
|
/* Ensures that <buf> is allocated, or allocates it. If no memory is available,
|
||||||
* ((char *)1) is assigned instead with a zero size. The allocated buffer is
|
* ((char *)1) is assigned instead with a zero size. The allocated buffer is
|
||||||
* returned, or NULL in case no memory is available.
|
* returned, or NULL in case no memory is available. Since buffers only contain
|
||||||
|
* user data, poisonning is always disabled as it brings no benefit and impacts
|
||||||
|
* performance. Due to the difficult buffer_wait management, they are not
|
||||||
|
* subject to forced allocation failures either.
|
||||||
*/
|
*/
|
||||||
#define b_alloc(_buf) \
|
#define b_alloc(_buf) \
|
||||||
({ \
|
({ \
|
||||||
@ -67,7 +70,7 @@ static inline int buffer_almost_full(const struct buffer *buf)
|
|||||||
\
|
\
|
||||||
if (!_retbuf->size) { \
|
if (!_retbuf->size) { \
|
||||||
*_retbuf = BUF_WANTED; \
|
*_retbuf = BUF_WANTED; \
|
||||||
_area = pool_alloc_flag(pool_head_buffer, POOL_F_NO_POISON); \
|
_area = pool_alloc_flag(pool_head_buffer, POOL_F_NO_POISON | POOL_F_NO_FAIL); \
|
||||||
if (unlikely(!_area)) { \
|
if (unlikely(!_area)) { \
|
||||||
activity[tid].buf_wait++; \
|
activity[tid].buf_wait++; \
|
||||||
_retbuf = NULL; \
|
_retbuf = NULL; \
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user