Lines Matching refs:zone
250 struct mlx4_zone_entry *zone = kmalloc(sizeof(*zone), GFP_KERNEL); in mlx4_zone_add_one() local
252 if (NULL == zone) in mlx4_zone_add_one()
255 zone->flags = flags; in mlx4_zone_add_one()
256 zone->bitmap = bitmap; in mlx4_zone_add_one()
257 zone->use_rr = (flags & MLX4_ZONE_USE_RR) ? MLX4_USE_RR : 0; in mlx4_zone_add_one()
258 zone->priority = priority; in mlx4_zone_add_one()
259 zone->offset = offset; in mlx4_zone_add_one()
263 zone->uid = zone_alloc->last_uid++; in mlx4_zone_add_one()
264 zone->allocator = zone_alloc; in mlx4_zone_add_one()
274 list_add_tail(&zone->prio_list, &it->prio_list); in mlx4_zone_add_one()
275 list_add_tail(&zone->list, &it->list); in mlx4_zone_add_one()
279 *puid = zone->uid; in mlx4_zone_add_one()
321 struct mlx4_zone_entry *zone, *tmp; in mlx4_zone_allocator_destroy() local
325 list_for_each_entry_safe(zone, tmp, &zone_alloc->entries, list) { in mlx4_zone_allocator_destroy()
326 list_del(&zone->list); in mlx4_zone_allocator_destroy()
327 list_del(&zone->prio_list); in mlx4_zone_allocator_destroy()
328 kfree(zone); in mlx4_zone_allocator_destroy()
336 static u32 __mlx4_alloc_from_zone(struct mlx4_zone_entry *zone, int count, in __mlx4_alloc_from_zone() argument
341 struct mlx4_zone_allocator *zone_alloc = zone->allocator; in __mlx4_alloc_from_zone()
344 res = mlx4_bitmap_alloc_range(zone->bitmap, count, in __mlx4_alloc_from_zone()
348 res += zone->offset; in __mlx4_alloc_from_zone()
349 uid = zone->uid; in __mlx4_alloc_from_zone()
354 if (unlikely(curr_node->priority == zone->priority)) in __mlx4_alloc_from_zone()
358 if (zone->flags & MLX4_ZONE_ALLOW_ALLOC_FROM_LOWER_PRIO) { in __mlx4_alloc_from_zone()
372 if (zone->flags & MLX4_ZONE_ALLOW_ALLOC_FROM_EQ_PRIO) { in __mlx4_alloc_from_zone()
376 if (unlikely(it == zone)) in __mlx4_alloc_from_zone()
392 if (zone->flags & MLX4_ZONE_FALLBACK_TO_HIGHER_PRIO) { in __mlx4_alloc_from_zone()
418 static void __mlx4_free_from_zone(struct mlx4_zone_entry *zone, u32 obj, in __mlx4_free_from_zone() argument
421 mlx4_bitmap_free_range(zone->bitmap, obj - zone->offset, count, zone->use_rr); in __mlx4_free_from_zone()
428 struct mlx4_zone_entry *zone; in __mlx4_find_zone_by_uid() local
430 list_for_each_entry(zone, &zones->entries, list) { in __mlx4_find_zone_by_uid()
431 if (zone->uid == uid) in __mlx4_find_zone_by_uid()
432 return zone; in __mlx4_find_zone_by_uid()
440 struct mlx4_zone_entry *zone; in mlx4_zone_get_bitmap() local
445 zone = __mlx4_find_zone_by_uid(zones, uid); in mlx4_zone_get_bitmap()
447 bitmap = zone == NULL ? NULL : zone->bitmap; in mlx4_zone_get_bitmap()
456 struct mlx4_zone_entry *zone; in mlx4_zone_remove_one() local
461 zone = __mlx4_find_zone_by_uid(zones, uid); in mlx4_zone_remove_one()
463 if (NULL == zone) { in mlx4_zone_remove_one()
468 __mlx4_zone_remove_one_entry(zone); in mlx4_zone_remove_one()
472 kfree(zone); in mlx4_zone_remove_one()
481 struct mlx4_zone_entry *zone, *zone_candidate = NULL; in __mlx4_find_zone_by_uid_unique() local
490 list_for_each_entry(zone, &zones->entries, list) { in __mlx4_find_zone_by_uid_unique()
491 if (obj >= zone->offset) { in __mlx4_find_zone_by_uid_unique()
492 u32 mobj = (obj - zone->offset) & zones->mask; in __mlx4_find_zone_by_uid_unique()
494 if (mobj < zone->bitmap->max) { in __mlx4_find_zone_by_uid_unique()
495 u32 curr_dist = zone->bitmap->effective_len; in __mlx4_find_zone_by_uid_unique()
499 zone_candidate = zone; in __mlx4_find_zone_by_uid_unique()
511 struct mlx4_zone_entry *zone; in mlx4_zone_alloc_entries() local
516 zone = __mlx4_find_zone_by_uid(zones, uid); in mlx4_zone_alloc_entries()
518 if (NULL == zone) in mlx4_zone_alloc_entries()
521 res = __mlx4_alloc_from_zone(zone, count, align, skip_mask, puid); in mlx4_zone_alloc_entries()
531 struct mlx4_zone_entry *zone; in mlx4_zone_free_entries() local
536 zone = __mlx4_find_zone_by_uid(zones, uid); in mlx4_zone_free_entries()
538 if (NULL == zone) { in mlx4_zone_free_entries()
543 __mlx4_free_from_zone(zone, obj, count); in mlx4_zone_free_entries()
553 struct mlx4_zone_entry *zone; in mlx4_zone_free_entries_unique() local
561 zone = __mlx4_find_zone_by_uid_unique(zones, obj); in mlx4_zone_free_entries_unique()
563 if (NULL == zone) { in mlx4_zone_free_entries_unique()
568 __mlx4_free_from_zone(zone, obj, count); in mlx4_zone_free_entries_unique()