MINOR: pools: make pool_evict_last_items() use pool_put_to_os_no_dec()

The bucket is already known, no need to calculate it again. Let's just
include the lower level functions.
This commit is contained in:
Willy Tarreau 2023-08-12 12:34:09 +02:00
parent 7bf829ace1
commit 29eed99b50

View File

@ -512,6 +512,7 @@ static void pool_evict_last_items(struct pool_head *pool, struct pool_cache_head
uint released = 0; uint released = 0;
uint cluster = 0; uint cluster = 0;
uint to_free_max; uint to_free_max;
uint bucket;
BUG_ON(pool_debugging & POOL_DBG_NO_CACHE); BUG_ON(pool_debugging & POOL_DBG_NO_CACHE);
@ -526,12 +527,12 @@ static void pool_evict_last_items(struct pool_head *pool, struct pool_cache_head
LIST_DELETE(&item->by_pool); LIST_DELETE(&item->by_pool);
LIST_DELETE(&item->by_lru); LIST_DELETE(&item->by_lru);
bucket = pool_pbucket(item);
_HA_ATOMIC_DEC(&pool->buckets[bucket].used);
swrate_add_opportunistic(&pool->buckets[bucket].needed_avg, POOL_AVG_SAMPLES, pool->buckets[bucket].used);
if (to_free_max > released || cluster) { if (to_free_max > released || cluster) {
/* will never match when global pools are disabled */ /* will never match when global pools are disabled */
uint bucket = pool_pbucket(item);
_HA_ATOMIC_DEC(&pool->buckets[bucket].used);
swrate_add_opportunistic(&pool->buckets[bucket].needed_avg, POOL_AVG_SAMPLES, pool->buckets[bucket].used);
pi = (struct pool_item *)item; pi = (struct pool_item *)item;
pi->next = NULL; pi->next = NULL;
pi->down = head; pi->down = head;
@ -543,8 +544,11 @@ static void pool_evict_last_items(struct pool_head *pool, struct pool_cache_head
cluster = 0; cluster = 0;
head = NULL; head = NULL;
} }
} else } else {
pool_free_nocache(pool, item); /* does pool_free_nocache() with a known bucket */
_HA_ATOMIC_DEC(&pool->buckets[bucket].allocated);
pool_put_to_os_nodec(pool, item);
}
released++; released++;
} }