Lines Matching refs:rg

252 					      struct file_region *rg)  in copy_hugetlb_cgroup_uncharge_info()  argument
255 nrg->reservation_counter = rg->reservation_counter; in copy_hugetlb_cgroup_uncharge_info()
256 nrg->css = rg->css; in copy_hugetlb_cgroup_uncharge_info()
257 if (rg->css) in copy_hugetlb_cgroup_uncharge_info()
258 css_get(rg->css); in copy_hugetlb_cgroup_uncharge_info()
286 static bool has_same_uncharge_info(struct file_region *rg, in has_same_uncharge_info() argument
290 return rg && org && in has_same_uncharge_info()
291 rg->reservation_counter == org->reservation_counter && in has_same_uncharge_info()
292 rg->css == org->css; in has_same_uncharge_info()
299 static void coalesce_file_region(struct resv_map *resv, struct file_region *rg) in coalesce_file_region() argument
303 prg = list_prev_entry(rg, link); in coalesce_file_region()
304 if (&prg->link != &resv->regions && prg->to == rg->from && in coalesce_file_region()
305 has_same_uncharge_info(prg, rg)) { in coalesce_file_region()
306 prg->to = rg->to; in coalesce_file_region()
308 list_del(&rg->link); in coalesce_file_region()
309 kfree(rg); in coalesce_file_region()
311 rg = prg; in coalesce_file_region()
314 nrg = list_next_entry(rg, link); in coalesce_file_region()
315 if (&nrg->link != &resv->regions && nrg->from == rg->to && in coalesce_file_region()
316 has_same_uncharge_info(nrg, rg)) { in coalesce_file_region()
317 nrg->from = rg->from; in coalesce_file_region()
319 list_del(&rg->link); in coalesce_file_region()
320 kfree(rg); in coalesce_file_region()
339 struct file_region *rg = NULL, *trg = NULL, *nrg = NULL; in add_reservation_in_range() local
348 list_for_each_entry_safe(rg, trg, head, link) { in add_reservation_in_range()
350 if (rg->from < f) { in add_reservation_in_range()
354 if (rg->to > last_accounted_offset) in add_reservation_in_range()
355 last_accounted_offset = rg->to; in add_reservation_in_range()
362 if (rg->from > t) in add_reservation_in_range()
368 if (rg->from > last_accounted_offset) { in add_reservation_in_range()
369 add += rg->from - last_accounted_offset; in add_reservation_in_range()
372 resv, last_accounted_offset, rg->from); in add_reservation_in_range()
375 list_add(&nrg->link, rg->link.prev); in add_reservation_in_range()
381 last_accounted_offset = rg->to; in add_reservation_in_range()
393 list_add(&nrg->link, rg->link.prev); in add_reservation_in_range()
411 struct file_region *trg = NULL, *rg = NULL; in allocate_file_region_entries() local
454 list_for_each_entry_safe(rg, trg, &allocated_regions, link) { in allocate_file_region_entries()
455 list_del(&rg->link); in allocate_file_region_entries()
456 kfree(rg); in allocate_file_region_entries()
608 struct file_region *rg, *trg; in region_del() local
614 list_for_each_entry_safe(rg, trg, head, link) { in region_del()
622 if (rg->to <= f && (rg->to != rg->from || rg->to != f)) in region_del()
625 if (rg->from >= t) in region_del()
628 if (f > rg->from && t < rg->to) { /* Must split region */ in region_del()
652 resv, rg, t - f); in region_del()
656 nrg->to = rg->to; in region_del()
658 copy_hugetlb_cgroup_uncharge_info(nrg, rg); in region_del()
663 rg->to = f; in region_del()
665 list_add(&nrg->link, &rg->link); in region_del()
670 if (f <= rg->from && t >= rg->to) { /* Remove entire region */ in region_del()
671 del += rg->to - rg->from; in region_del()
672 hugetlb_cgroup_uncharge_file_region(resv, rg, in region_del()
673 rg->to - rg->from); in region_del()
674 list_del(&rg->link); in region_del()
675 kfree(rg); in region_del()
679 if (f <= rg->from) { /* Trim beginning of region */ in region_del()
680 hugetlb_cgroup_uncharge_file_region(resv, rg, in region_del()
681 t - rg->from); in region_del()
683 del += t - rg->from; in region_del()
684 rg->from = t; in region_del()
686 hugetlb_cgroup_uncharge_file_region(resv, rg, in region_del()
687 rg->to - f); in region_del()
689 del += rg->to - f; in region_del()
690 rg->to = f; in region_del()
728 struct file_region *rg; in region_count() local
733 list_for_each_entry(rg, head, link) { in region_count()
737 if (rg->to <= f) in region_count()
739 if (rg->from >= t) in region_count()
742 seg_from = max(rg->from, f); in region_count()
743 seg_to = min(rg->to, t); in region_count()
854 struct file_region *rg = kmalloc(sizeof(*rg), GFP_KERNEL); in resv_map_alloc() local
856 if (!resv_map || !rg) { in resv_map_alloc()
858 kfree(rg); in resv_map_alloc()
876 list_add(&rg->link, &resv_map->region_cache); in resv_map_alloc()
886 struct file_region *rg, *trg; in resv_map_release() local
892 list_for_each_entry_safe(rg, trg, head, link) { in resv_map_release()
893 list_del(&rg->link); in resv_map_release()
894 kfree(rg); in resv_map_release()