Lines Matching refs:zone

251 	struct mlx4_zone_entry *zone = kmalloc(sizeof(*zone), GFP_KERNEL);  in mlx4_zone_add_one()  local
253 if (NULL == zone) in mlx4_zone_add_one()
256 zone->flags = flags; in mlx4_zone_add_one()
257 zone->bitmap = bitmap; in mlx4_zone_add_one()
258 zone->use_rr = (flags & MLX4_ZONE_USE_RR) ? MLX4_USE_RR : 0; in mlx4_zone_add_one()
259 zone->priority = priority; in mlx4_zone_add_one()
260 zone->offset = offset; in mlx4_zone_add_one()
264 zone->uid = zone_alloc->last_uid++; in mlx4_zone_add_one()
265 zone->allocator = zone_alloc; in mlx4_zone_add_one()
275 list_add_tail(&zone->prio_list, &it->prio_list); in mlx4_zone_add_one()
276 list_add_tail(&zone->list, &it->list); in mlx4_zone_add_one()
280 *puid = zone->uid; in mlx4_zone_add_one()
324 struct mlx4_zone_entry *zone, *tmp; in mlx4_zone_allocator_destroy() local
328 list_for_each_entry_safe(zone, tmp, &zone_alloc->entries, list) { in mlx4_zone_allocator_destroy()
329 list_del(&zone->list); in mlx4_zone_allocator_destroy()
330 list_del(&zone->prio_list); in mlx4_zone_allocator_destroy()
331 kfree(zone); in mlx4_zone_allocator_destroy()
339 static u32 __mlx4_alloc_from_zone(struct mlx4_zone_entry *zone, int count, in __mlx4_alloc_from_zone() argument
344 struct mlx4_zone_allocator *zone_alloc = zone->allocator; in __mlx4_alloc_from_zone()
347 res = mlx4_bitmap_alloc_range(zone->bitmap, count, in __mlx4_alloc_from_zone()
351 res += zone->offset; in __mlx4_alloc_from_zone()
352 uid = zone->uid; in __mlx4_alloc_from_zone()
357 if (unlikely(curr_node->priority == zone->priority)) in __mlx4_alloc_from_zone()
361 if (zone->flags & MLX4_ZONE_ALLOW_ALLOC_FROM_LOWER_PRIO) { in __mlx4_alloc_from_zone()
375 if (zone->flags & MLX4_ZONE_ALLOW_ALLOC_FROM_EQ_PRIO) { in __mlx4_alloc_from_zone()
379 if (unlikely(it == zone)) in __mlx4_alloc_from_zone()
395 if (zone->flags & MLX4_ZONE_FALLBACK_TO_HIGHER_PRIO) { in __mlx4_alloc_from_zone()
421 static void __mlx4_free_from_zone(struct mlx4_zone_entry *zone, u32 obj, in __mlx4_free_from_zone() argument
424 mlx4_bitmap_free_range(zone->bitmap, obj - zone->offset, count, zone->use_rr); in __mlx4_free_from_zone()
431 struct mlx4_zone_entry *zone; in __mlx4_find_zone_by_uid() local
433 list_for_each_entry(zone, &zones->entries, list) { in __mlx4_find_zone_by_uid()
434 if (zone->uid == uid) in __mlx4_find_zone_by_uid()
435 return zone; in __mlx4_find_zone_by_uid()
443 struct mlx4_zone_entry *zone; in mlx4_zone_get_bitmap() local
448 zone = __mlx4_find_zone_by_uid(zones, uid); in mlx4_zone_get_bitmap()
450 bitmap = zone == NULL ? NULL : zone->bitmap; in mlx4_zone_get_bitmap()
459 struct mlx4_zone_entry *zone; in mlx4_zone_remove_one() local
464 zone = __mlx4_find_zone_by_uid(zones, uid); in mlx4_zone_remove_one()
466 if (NULL == zone) { in mlx4_zone_remove_one()
471 res = __mlx4_zone_remove_one_entry(zone); in mlx4_zone_remove_one()
475 kfree(zone); in mlx4_zone_remove_one()
484 struct mlx4_zone_entry *zone, *zone_candidate = NULL; in __mlx4_find_zone_by_uid_unique() local
493 list_for_each_entry(zone, &zones->entries, list) { in __mlx4_find_zone_by_uid_unique()
494 if (obj >= zone->offset) { in __mlx4_find_zone_by_uid_unique()
495 u32 mobj = (obj - zone->offset) & zones->mask; in __mlx4_find_zone_by_uid_unique()
497 if (mobj < zone->bitmap->max) { in __mlx4_find_zone_by_uid_unique()
498 u32 curr_dist = zone->bitmap->effective_len; in __mlx4_find_zone_by_uid_unique()
502 zone_candidate = zone; in __mlx4_find_zone_by_uid_unique()
514 struct mlx4_zone_entry *zone; in mlx4_zone_alloc_entries() local
519 zone = __mlx4_find_zone_by_uid(zones, uid); in mlx4_zone_alloc_entries()
521 if (NULL == zone) in mlx4_zone_alloc_entries()
524 res = __mlx4_alloc_from_zone(zone, count, align, skip_mask, puid); in mlx4_zone_alloc_entries()
534 struct mlx4_zone_entry *zone; in mlx4_zone_free_entries() local
539 zone = __mlx4_find_zone_by_uid(zones, uid); in mlx4_zone_free_entries()
541 if (NULL == zone) { in mlx4_zone_free_entries()
546 __mlx4_free_from_zone(zone, obj, count); in mlx4_zone_free_entries()
556 struct mlx4_zone_entry *zone; in mlx4_zone_free_entries_unique() local
564 zone = __mlx4_find_zone_by_uid_unique(zones, obj); in mlx4_zone_free_entries_unique()
566 if (NULL == zone) { in mlx4_zone_free_entries_unique()
571 __mlx4_free_from_zone(zone, obj, count); in mlx4_zone_free_entries_unique()