summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilly Tarreau <w@1wt.eu>2021-04-15 20:12:48 +0200
committerWilly Tarreau <w@1wt.eu>2021-04-15 20:15:12 +0200
commit0d4102d0a4596f2b27c436f23bfeb33f3848ff5e (patch)
tree65c338b264a8c445d4735b242bf0bd7553a3ae68
parenta0b49a1f0de4138c0609c463eaad7bd22bf10002 (diff)
downloadhaproxy-20210415-pools-3.tar.gz
CLEANUP: pools: rename pool_*_{from,to}_cache() to *_local_cache()20210415-pools-3
The functions were rightfully called from/to_cache when the thread-local cache was considered as the only cache, but this is getting terribly confusing. Let's call them from/to local_cache to make it clear that it is not related with the shared cache.
-rw-r--r--include/haproxy/pool.h12
-rw-r--r--src/pool.c2
2 files changed, 7 insertions, 7 deletions
diff --git a/include/haproxy/pool.h b/include/haproxy/pool.h
index 8eeeeaf70..c67593e77 100644
--- a/include/haproxy/pool.h
+++ b/include/haproxy/pool.h
@@ -80,7 +80,7 @@ extern struct pool_cache_head pool_cache[][MAX_BASE_POOLS];
extern THREAD_LOCAL size_t pool_cache_bytes; /* total cache size */
extern THREAD_LOCAL size_t pool_cache_count; /* #cache objects */
-void pool_evict_from_cache();
+void pool_evict_from_local_cache();
/* returns the pool index for pool <pool>, or -1 if this pool has no index */
static inline ssize_t pool_get_index(const struct pool_head *pool)
@@ -96,7 +96,7 @@ static inline ssize_t pool_get_index(const struct pool_head *pool)
/* Tries to retrieve an object from the local pool cache corresponding to pool
* <pool>. Returns NULL if none is available.
*/
-static inline void *__pool_get_from_cache(struct pool_head *pool)
+static inline void *pool_get_from_local_cache(struct pool_head *pool)
{
ssize_t idx = pool_get_index(pool);
struct pool_cache_item *item;
@@ -126,7 +126,7 @@ static inline void *__pool_get_from_cache(struct pool_head *pool)
/* Frees an object to the local cache, possibly pushing oldest objects to the
* global pool.
*/
-static inline void pool_put_to_cache(struct pool_head *pool, void *ptr, ssize_t idx)
+static inline void pool_put_to_local_cache(struct pool_head *pool, void *ptr, ssize_t idx)
{
struct pool_cache_item *item = (struct pool_cache_item *)ptr;
struct pool_cache_head *ph = &pool_cache[tid][idx];
@@ -138,7 +138,7 @@ static inline void pool_put_to_cache(struct pool_head *pool, void *ptr, ssize_t
pool_cache_bytes += ph->size;
if (unlikely(pool_cache_bytes > CONFIG_HAP_POOL_CACHE_SIZE))
- pool_evict_from_cache(pool, ptr, idx);
+ pool_evict_from_local_cache(pool, ptr, idx);
}
#else // CONFIG_HAP_POOLS
@@ -300,7 +300,7 @@ static inline void *__pool_alloc(struct pool_head *pool, unsigned int flags)
void *p;
#ifdef CONFIG_HAP_POOLS
- if (likely(p = __pool_get_from_cache(pool)))
+ if (likely(p = pool_get_from_local_cache(pool)))
goto ret;
#endif
@@ -366,7 +366,7 @@ static inline void pool_free(struct pool_head *pool, void *ptr)
if (idx >= 0 &&
(pool_cache_bytes <= CONFIG_HAP_POOL_CACHE_SIZE * 3 / 4 ||
pool_cache[tid][idx].count < 16 + pool_cache_count / 8)) {
- pool_put_to_cache(pool, ptr, idx);
+ pool_put_to_local_cache(pool, ptr, idx);
return;
}
#endif
diff --git a/src/pool.c b/src/pool.c
index 83ff6620c..fd6e107ff 100644
--- a/src/pool.c
+++ b/src/pool.c
@@ -149,7 +149,7 @@ struct pool_head *create_pool(char *name, unsigned int size, unsigned int flags)
/* Evicts some of the oldest objects from the local cache, pushing them to the
* global pool.
*/
-void pool_evict_from_cache()
+void pool_evict_from_local_cache()
{
struct pool_cache_item *item;
struct pool_cache_head *ph;