Lines Matching refs:rg

421 					      struct file_region *rg)  in copy_hugetlb_cgroup_uncharge_info()  argument
424 nrg->reservation_counter = rg->reservation_counter; in copy_hugetlb_cgroup_uncharge_info()
425 nrg->css = rg->css; in copy_hugetlb_cgroup_uncharge_info()
426 if (rg->css) in copy_hugetlb_cgroup_uncharge_info()
427 css_get(rg->css); in copy_hugetlb_cgroup_uncharge_info()
466 static void put_uncharge_info(struct file_region *rg) in put_uncharge_info() argument
469 if (rg->css) in put_uncharge_info()
470 css_put(rg->css); in put_uncharge_info()
474 static bool has_same_uncharge_info(struct file_region *rg, in has_same_uncharge_info() argument
478 return rg->reservation_counter == org->reservation_counter && in has_same_uncharge_info()
479 rg->css == org->css; in has_same_uncharge_info()
486 static void coalesce_file_region(struct resv_map *resv, struct file_region *rg) in coalesce_file_region() argument
490 prg = list_prev_entry(rg, link); in coalesce_file_region()
491 if (&prg->link != &resv->regions && prg->to == rg->from && in coalesce_file_region()
492 has_same_uncharge_info(prg, rg)) { in coalesce_file_region()
493 prg->to = rg->to; in coalesce_file_region()
495 list_del(&rg->link); in coalesce_file_region()
496 put_uncharge_info(rg); in coalesce_file_region()
497 kfree(rg); in coalesce_file_region()
499 rg = prg; in coalesce_file_region()
502 nrg = list_next_entry(rg, link); in coalesce_file_region()
503 if (&nrg->link != &resv->regions && nrg->from == rg->to && in coalesce_file_region()
504 has_same_uncharge_info(nrg, rg)) { in coalesce_file_region()
505 nrg->from = rg->from; in coalesce_file_region()
507 list_del(&rg->link); in coalesce_file_region()
508 put_uncharge_info(rg); in coalesce_file_region()
509 kfree(rg); in coalesce_file_region()
514 hugetlb_resv_map_add(struct resv_map *map, struct list_head *rg, long from, in hugetlb_resv_map_add() argument
523 list_add(&nrg->link, rg); in hugetlb_resv_map_add()
547 struct list_head *rg = NULL; in add_reservation_in_range() local
571 rg = iter->link.prev; in add_reservation_in_range()
590 if (!rg) in add_reservation_in_range()
591 rg = head->prev; in add_reservation_in_range()
593 add += hugetlb_resv_map_add(resv, rg, last_accounted_offset, in add_reservation_in_range()
607 struct file_region *trg = NULL, *rg = NULL; in allocate_file_region_entries() local
648 list_for_each_entry_safe(rg, trg, &allocated_regions, link) { in allocate_file_region_entries()
649 list_del(&rg->link); in allocate_file_region_entries()
650 kfree(rg); in allocate_file_region_entries()
801 struct file_region *rg, *trg; in region_del() local
807 list_for_each_entry_safe(rg, trg, head, link) { in region_del()
815 if (rg->to <= f && (rg->to != rg->from || rg->to != f)) in region_del()
818 if (rg->from >= t) in region_del()
821 if (f > rg->from && t < rg->to) { /* Must split region */ in region_del()
845 resv, rg, t - f, false); in region_del()
849 nrg->to = rg->to; in region_del()
851 copy_hugetlb_cgroup_uncharge_info(nrg, rg); in region_del()
856 rg->to = f; in region_del()
858 list_add(&nrg->link, &rg->link); in region_del()
863 if (f <= rg->from && t >= rg->to) { /* Remove entire region */ in region_del()
864 del += rg->to - rg->from; in region_del()
865 hugetlb_cgroup_uncharge_file_region(resv, rg, in region_del()
866 rg->to - rg->from, true); in region_del()
867 list_del(&rg->link); in region_del()
868 kfree(rg); in region_del()
872 if (f <= rg->from) { /* Trim beginning of region */ in region_del()
873 hugetlb_cgroup_uncharge_file_region(resv, rg, in region_del()
874 t - rg->from, false); in region_del()
876 del += t - rg->from; in region_del()
877 rg->from = t; in region_del()
879 hugetlb_cgroup_uncharge_file_region(resv, rg, in region_del()
880 rg->to - f, false); in region_del()
882 del += rg->to - f; in region_del()
883 rg->to = f; in region_del()
928 struct file_region *rg; in region_count() local
933 list_for_each_entry(rg, head, link) { in region_count()
937 if (rg->to <= f) in region_count()
939 if (rg->from >= t) in region_count()
942 seg_from = max(rg->from, f); in region_count()
943 seg_to = min(rg->to, t); in region_count()
1054 struct file_region *rg = kmalloc(sizeof(*rg), GFP_KERNEL); in resv_map_alloc() local
1056 if (!resv_map || !rg) { in resv_map_alloc()
1058 kfree(rg); in resv_map_alloc()
1076 list_add(&rg->link, &resv_map->region_cache); in resv_map_alloc()
1086 struct file_region *rg, *trg; in resv_map_release() local
1092 list_for_each_entry_safe(rg, trg, head, link) { in resv_map_release()
1093 list_del(&rg->link); in resv_map_release()
1094 kfree(rg); in resv_map_release()