diff --git a/include/haproxy/pool.h b/include/haproxy/pool.h index 92fb6dfbf..d01c6d7c8 100644 --- a/include/haproxy/pool.h +++ b/include/haproxy/pool.h @@ -141,6 +141,7 @@ static inline void __pool_free(struct pool_head *pool, void *ptr) { _HA_ATOMIC_DEC(&pool->used); _HA_ATOMIC_DEC(&pool->allocated); + swrate_add(&pool->needed_avg, POOL_AVG_SAMPLES, pool->used); pool_free_area(ptr, pool->size + POOL_EXTRA); } diff --git a/src/pool.c b/src/pool.c index 59cc5083e..685d6b300 100644 --- a/src/pool.c +++ b/src/pool.c @@ -165,6 +165,8 @@ void *__pool_refill_alloc(struct pool_head *pool, unsigned int avail) return NULL; } + swrate_add_scaled(&pool->needed_avg, POOL_AVG_SAMPLES, pool->allocated, POOL_AVG_SAMPLES/4); + ptr = pool_alloc_area(pool->size + POOL_EXTRA); if (!ptr) { _HA_ATOMIC_INC(&pool->failed);