bool new_mem = false;
int err;
- /* Check if we have chunks that are waiting for sync-ste */
- if (dr_icm_pool_is_sync_required(pool))
- dr_icm_pool_sync_all_buddy_pools(pool);
-
alloc_buddy_mem:
/* find the next free place from the buddy list */
list_for_each_entry(buddy_mem_pool, &pool->buddy_mem_list, list_node) {
void mlx5dr_icm_free_chunk(struct mlx5dr_icm_chunk *chunk)
{
struct mlx5dr_icm_buddy_mem *buddy = chunk->buddy_mem;
+ struct mlx5dr_icm_pool *pool = buddy->pool;
/* move the memory to the waiting list AKA "hot" */
- mutex_lock(&buddy->pool->mutex);
+ mutex_lock(&pool->mutex);
list_move_tail(&chunk->chunk_list, &buddy->hot_list);
buddy->hot_memory_size += chunk->byte_size;
- mutex_unlock(&buddy->pool->mutex);
+
+ /* Check if we have chunks that are waiting for sync-ste */
+ if (dr_icm_pool_is_sync_required(pool))
+ dr_icm_pool_sync_all_buddy_pools(pool);
+
+ mutex_unlock(&pool->mutex);
}
struct mlx5dr_icm_pool *mlx5dr_icm_pool_create(struct mlx5dr_domain *dmn,