]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: pools: rename pool_*_{from,to}_cache() to *_local_cache()
authorWilly Tarreau <w@1wt.eu>
Thu, 15 Apr 2021 18:12:48 +0000 (20:12 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 19 Apr 2021 13:24:33 +0000 (15:24 +0200)
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.

As a side note, since pool_evict_from_cache() used not to work for a
particular pool but for all of them at once, it was renamed to
pool_evict_from_local_caches()  (plural form).

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

index 0b1d250ed74317e0f4dd7725b5abe158d58e85e4..c8e5ca5ae49531ac0839372b6e209016f35f4423 100644 (file)
@@ -77,12 +77,12 @@ static inline int pool_is_crowded(const struct pool_head *pool)
 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_caches();
 
 /* 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)
 {
        struct pool_cache_item *item;
        struct pool_cache_head *ph;
@@ -107,7 +107,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)
+static inline void pool_put_to_local_cache(struct pool_head *pool, void *ptr)
 {
        struct pool_cache_item *item = (struct pool_cache_item *)ptr;
        struct pool_cache_head *ph = &pool->cache[tid];
@@ -119,7 +119,7 @@ static inline void pool_put_to_cache(struct pool_head *pool, void *ptr)
        pool_cache_bytes += pool->size;
 
        if (unlikely(pool_cache_bytes > CONFIG_HAP_POOL_CACHE_SIZE))
-               pool_evict_from_cache();
+               pool_evict_from_local_caches();
 }
 
 #endif // CONFIG_HAP_POOLS
@@ -276,7 +276,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
 
@@ -338,7 +338,7 @@ static inline void pool_free(struct pool_head *pool, void *ptr)
                 */
                if ((pool_cache_bytes <= CONFIG_HAP_POOL_CACHE_SIZE * 3 / 4 ||
                     pool->cache[tid].count < 16 + pool_cache_count / 8)) {
-                       pool_put_to_cache(pool, ptr);
+                       pool_put_to_local_cache(pool, ptr);
                        return;
                }
 #endif
index 61b7a7ad1b691571d38281b1ab5ad674432515af..d1e48fd77068fa95de6ddf1f5d846d990fdd60ce 100644 (file)
@@ -123,7 +123,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_caches()
 {
        struct pool_cache_item *item;
        struct pool_cache_head *ph;