MINOR: pools: always evict oldest objects first in pool_evict_from_local_cache()

For an unknown reason, despite the comment stating that we were evicting
oldest objects first from the local caches, due to the use of LIST_NEXT,
the newest were evicted, since pool_put_to_cache() uses LIST_INSERT().

Some tests on 16 threads show that evicting oldest objects instead can
improve performance by 0.5-1% especially when using shared pools.
This commit is contained in:
Willy Tarreau 2022-01-02 12:40:14 +01:00
parent f645047168
commit d5ec100661

View File

@ -316,7 +316,7 @@ void pool_evict_from_local_cache(struct pool_head *pool)
while (ph->count >= 16 + pool_cache_count / 8 &&
pool_cache_bytes > CONFIG_HAP_POOL_CACHE_SIZE * 3 / 4) {
item = LIST_NEXT(&ph->list, typeof(item), by_pool);
item = LIST_PREV(&ph->list, typeof(item), by_pool);
ph->count--;
pool_cache_bytes -= pool->size;
pool_cache_count--;