mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-03-02 09:30:36 +00:00
BUILD: memory: fix free_list pointer declaration again for atomic CAS
Similary to what's been done in 7a6ad88b02
,
take into account that free_list that free_list is a void **, and so use
a void ** too when attempting to do a CAS.
This commit is contained in:
parent
62975a7740
commit
8b2c8a7894
@ -137,7 +137,7 @@ struct pool_head *create_pool(char *name, unsigned int size, unsigned int flags)
|
|||||||
*/
|
*/
|
||||||
void *__pool_refill_alloc(struct pool_head *pool, unsigned int avail)
|
void *__pool_refill_alloc(struct pool_head *pool, unsigned int avail)
|
||||||
{
|
{
|
||||||
void *ptr = NULL, *free_list;
|
void *ptr = NULL, **free_list;
|
||||||
int failed = 0;
|
int failed = 0;
|
||||||
int size = pool->size;
|
int size = pool->size;
|
||||||
int limit = pool->limit;
|
int limit = pool->limit;
|
||||||
@ -168,7 +168,7 @@ void *__pool_refill_alloc(struct pool_head *pool, unsigned int avail)
|
|||||||
do {
|
do {
|
||||||
*POOL_LINK(pool, ptr) = free_list;
|
*POOL_LINK(pool, ptr) = free_list;
|
||||||
__ha_barrier_store();
|
__ha_barrier_store();
|
||||||
} while (HA_ATOMIC_CAS(&pool->free_list, (void **)&free_list, ptr) == 0);
|
} while (HA_ATOMIC_CAS(&pool->free_list, &free_list, ptr) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
HA_ATOMIC_ADD(&pool->allocated, allocated - allocated_orig);
|
HA_ATOMIC_ADD(&pool->allocated, allocated - allocated_orig);
|
||||||
@ -192,14 +192,14 @@ void *pool_refill_alloc(struct pool_head *pool, unsigned int avail)
|
|||||||
*/
|
*/
|
||||||
void pool_flush(struct pool_head *pool)
|
void pool_flush(struct pool_head *pool)
|
||||||
{
|
{
|
||||||
void *next, *temp;
|
void **next, *temp;
|
||||||
int removed = 0;
|
int removed = 0;
|
||||||
|
|
||||||
if (!pool)
|
if (!pool)
|
||||||
return;
|
return;
|
||||||
do {
|
do {
|
||||||
next = pool->free_list;
|
next = pool->free_list;
|
||||||
} while (!HA_ATOMIC_CAS(&pool->free_list, (void **)&next, NULL));
|
} while (!HA_ATOMIC_CAS(&pool->free_list, &next, NULL));
|
||||||
while (next) {
|
while (next) {
|
||||||
temp = next;
|
temp = next;
|
||||||
next = *POOL_LINK(pool, temp);
|
next = *POOL_LINK(pool, temp);
|
||||||
|
Loading…
Reference in New Issue
Block a user