mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-29 17:51:22 +02:00
MINOR: pools: pass the objects count to pool_put_to_shared_cache()
This is in order to let the caller build the cluster of items to be released. For now single items are released hence the count is always 1.
This commit is contained in:
parent
148160b027
commit
337410c5a4
@ -129,7 +129,7 @@ static inline void pool_refill_local_from_shared(struct pool_head *pool, struct
|
|||||||
/* ignored without shared pools */
|
/* ignored without shared pools */
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void pool_put_to_shared_cache(struct pool_head *pool, struct pool_item *item)
|
static inline void pool_put_to_shared_cache(struct pool_head *pool, struct pool_item *item, uint count)
|
||||||
{
|
{
|
||||||
/* ignored without shared pools */
|
/* ignored without shared pools */
|
||||||
}
|
}
|
||||||
@ -137,7 +137,7 @@ static inline void pool_put_to_shared_cache(struct pool_head *pool, struct pool_
|
|||||||
#else /* CONFIG_HAP_NO_GLOBAL_POOLS */
|
#else /* CONFIG_HAP_NO_GLOBAL_POOLS */
|
||||||
|
|
||||||
void pool_refill_local_from_shared(struct pool_head *pool, struct pool_cache_head *pch);
|
void pool_refill_local_from_shared(struct pool_head *pool, struct pool_cache_head *pch);
|
||||||
void pool_put_to_shared_cache(struct pool_head *pool, struct pool_item *item);
|
void pool_put_to_shared_cache(struct pool_head *pool, struct pool_item *item, uint count);
|
||||||
|
|
||||||
/* returns true if the pool is considered to have too many free objects */
|
/* returns true if the pool is considered to have too many free objects */
|
||||||
static inline int pool_is_crowded(const struct pool_head *pool)
|
static inline int pool_is_crowded(const struct pool_head *pool)
|
||||||
|
16
src/pool.c
16
src/pool.c
@ -338,7 +338,7 @@ void pool_evict_from_local_cache(struct pool_head *pool)
|
|||||||
pi = to_free;
|
pi = to_free;
|
||||||
pi->down = NULL;
|
pi->down = NULL;
|
||||||
to_free = pi->next;
|
to_free = pi->next;
|
||||||
pool_put_to_shared_cache(pool, pi);
|
pool_put_to_shared_cache(pool, pi, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -369,7 +369,7 @@ void pool_evict_from_local_caches()
|
|||||||
struct pool_item *pi = (struct pool_item *)item;
|
struct pool_item *pi = (struct pool_item *)item;
|
||||||
|
|
||||||
pi->down = NULL;
|
pi->down = NULL;
|
||||||
pool_put_to_shared_cache(pool, pi);
|
pool_put_to_shared_cache(pool, pi, 1);
|
||||||
}
|
}
|
||||||
} while (pool_cache_bytes > CONFIG_HAP_POOL_CACHE_SIZE * 7 / 8);
|
} while (pool_cache_bytes > CONFIG_HAP_POOL_CACHE_SIZE * 7 / 8);
|
||||||
}
|
}
|
||||||
@ -465,16 +465,16 @@ void pool_refill_local_from_shared(struct pool_head *pool, struct pool_cache_hea
|
|||||||
pool_cache_bytes += count * pool->size;
|
pool_cache_bytes += count * pool->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Adds cache item entry <item> to the shared cache. The caller is advised to
|
/* Adds pool item cluster <item> to the shared cache, which contains <count>
|
||||||
* first check using pool_is_crowded() if it's wise to add this object there.
|
* elements. The caller is advised to first check using pool_releasable() if
|
||||||
* Both the pool and the item must be valid. Use pool_free() for normal
|
* it's wise to add this series of objects there. Both the pool and the item's
|
||||||
* operations.
|
* head must be valid.
|
||||||
*/
|
*/
|
||||||
void pool_put_to_shared_cache(struct pool_head *pool, struct pool_item *item)
|
void pool_put_to_shared_cache(struct pool_head *pool, struct pool_item *item, uint count)
|
||||||
{
|
{
|
||||||
struct pool_item *free_list;
|
struct pool_item *free_list;
|
||||||
|
|
||||||
_HA_ATOMIC_DEC(&pool->used);
|
_HA_ATOMIC_SUB(&pool->used, count);
|
||||||
free_list = _HA_ATOMIC_LOAD(&pool->free_list);
|
free_list = _HA_ATOMIC_LOAD(&pool->free_list);
|
||||||
do {
|
do {
|
||||||
while (unlikely(free_list == POOL_BUSY)) {
|
while (unlikely(free_list == POOL_BUSY)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user