]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: pools: group list updates in pool_get_from_cache()
authorWilly Tarreau <w@1wt.eu>
Sun, 2 Jan 2022 18:34:19 +0000 (19:34 +0100)
committerWilly Tarreau <w@1wt.eu>
Sun, 2 Jan 2022 18:34:19 +0000 (19:34 +0100)
Some changes affect the list element and others affect the pool stats.
Better group them together, as the compiler may not detect certain
possible optimizations after the casts made by the list macros.

include/haproxy/pool.h

index 81b392fc6a99357a65acbfb9fde8fe8d29c4e779..c899f776641e1493df0bbd159220245eb032addc 100644 (file)
@@ -184,14 +184,16 @@ static inline void *pool_get_from_cache(struct pool_head *pool)
        }
 
        item = LIST_NEXT(&ph->list, typeof(item), by_pool);
-       ph->count--;
-       pool_cache_bytes -= pool->size;
-       pool_cache_count--;
        LIST_DELETE(&item->by_pool);
        LIST_DELETE(&item->by_lru);
 
        /* keep track of where the element was allocated from */
        POOL_DEBUG_SET_MARK(pool, item);
+
+       ph->count--;
+       pool_cache_bytes -= pool->size;
+       pool_cache_count--;
+
        return item;
 }