From: Willy Tarreau Date: Sat, 17 Apr 2021 12:11:39 +0000 (+0200) Subject: CLEANUP: pools: rename __pool_free() to pool_put_to_shared_cache() X-Git-Tag: v2.4-dev17~69 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=635cced32fe717f3fa271161a75510cd66865fae;p=thirdparty%2Fhaproxy.git CLEANUP: pools: rename __pool_free() to pool_put_to_shared_cache() Now the multi-level cache becomes more visible: pool_get_from_local_cache() pool_put_to_local_cache() pool_get_from_shared_cache() pool_put_to_shared_cache() --- diff --git a/include/haproxy/pool.h b/include/haproxy/pool.h index c8e5ca5ae4..6f01971154 100644 --- a/include/haproxy/pool.h +++ b/include/haproxy/pool.h @@ -136,7 +136,7 @@ static inline void *pool_get_from_shared_cache(struct pool_head *pool) return NULL; } -static inline void __pool_free(struct pool_head *pool, void *ptr) +static inline void pool_put_to_shared_cache(struct pool_head *pool, void *ptr) { _HA_ATOMIC_DEC(&pool->used); _HA_ATOMIC_DEC(&pool->allocated); @@ -182,7 +182,7 @@ static inline void *pool_get_from_shared_cache(struct pool_head *pool) * Both the pool and the pointer must be valid. Use pool_free() for normal * operations. */ -static inline void __pool_free(struct pool_head *pool, void *ptr) +static inline void pool_put_to_shared_cache(struct pool_head *pool, void *ptr) { void **free_list = pool->free_list; @@ -234,7 +234,7 @@ static inline void *pool_get_from_shared_cache(struct pool_head *pool) /* unconditionally stores the object as-is into the global pool. The object * must not be NULL. Use pool_free() instead. */ -static inline void __pool_free(struct pool_head *pool, void *ptr) +static inline void pool_put_to_shared_cache(struct pool_head *pool, void *ptr) { #ifndef DEBUG_UAF /* normal pool behaviour */ HA_SPIN_LOCK(POOL_LOCK, &pool->lock); @@ -342,7 +342,7 @@ static inline void pool_free(struct pool_head *pool, void *ptr) return; } #endif - __pool_free(pool, ptr); + pool_put_to_shared_cache(pool, ptr); } } diff --git a/src/pool.c b/src/pool.c index d1e48fd770..db5d931015 100644 --- a/src/pool.c +++ b/src/pool.c @@ -141,7 +141,7 @@ void pool_evict_from_local_caches() ph->count--; pool_cache_count--; pool_cache_bytes -= pool->size; - __pool_free(pool, item); + pool_put_to_shared_cache(pool, item); } while (pool_cache_bytes > CONFIG_HAP_POOL_CACHE_SIZE * 7 / 8); } #endif