diff --git a/include/haproxy/pool.h b/include/haproxy/pool.h index 2a6fa9d42..1f9ca21f3 100644 --- a/include/haproxy/pool.h +++ b/include/haproxy/pool.h @@ -110,16 +110,14 @@ void pool_evict_from_local_cache(struct pool_head *pool); void pool_evict_from_local_caches(void); void pool_put_to_cache(struct pool_head *pool, void *ptr); -/* returns true if the pool is considered to have too many free objects */ +#if defined(CONFIG_HAP_NO_GLOBAL_POOLS) + static inline int pool_is_crowded(const struct pool_head *pool) { - return pool->allocated >= swrate_avg(pool->needed_avg + pool->needed_avg / 4, POOL_AVG_SAMPLES) && - (int)(pool->allocated - pool->used) >= pool->minavail; + /* no shared pools, hence they're always full */ + return 1; } - -#if defined(CONFIG_HAP_NO_GLOBAL_POOLS) - static inline void pool_refill_local_from_shared(struct pool_head *pool, struct pool_cache_head *pch) { /* ignored without shared pools */ @@ -134,6 +132,13 @@ static inline void pool_put_to_shared_cache(struct pool_head *pool, void *ptr) void pool_refill_local_from_shared(struct pool_head *pool, struct pool_cache_head *pch); +/* returns true if the pool is considered to have too many free objects */ +static inline int pool_is_crowded(const struct pool_head *pool) +{ + return pool->allocated >= swrate_avg(pool->needed_avg + pool->needed_avg / 4, POOL_AVG_SAMPLES) && + (int)(pool->allocated - pool->used) >= pool->minavail; +} + /* Locklessly add item to pool , then update the pool used count. * Both the pool and the pointer must be valid. Use pool_free() for normal * operations.