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