]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: pools: rename __pool_free() to pool_put_to_shared_cache()
authorWilly Tarreau <w@1wt.eu>
Sat, 17 Apr 2021 12:11:39 +0000 (14:11 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 19 Apr 2021 13:24:33 +0000 (15:24 +0200)
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()

include/haproxy/pool.h
src/pool.c

index c8e5ca5ae49531ac0839372b6e209016f35f4423..6f0197115440086a147275661c5333b673cdbf25 100644 (file)
@@ -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);
        }
 }
 
index d1e48fd77068fa95de6ddf1f5d846d990fdd60ce..db5d931015ada9fbacfb3a0fc938bcdac9d77f53 100644 (file)
@@ -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