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()
This commit is contained in:
Willy Tarreau 2021-04-17 14:11:39 +02:00
parent 8c77ee5ae5
commit 635cced32f
2 changed files with 5 additions and 5 deletions

View 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);
}
}

View 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