Lines Matching refs:rg

266 					      struct file_region *rg)  in copy_hugetlb_cgroup_uncharge_info()  argument
269 nrg->reservation_counter = rg->reservation_counter; in copy_hugetlb_cgroup_uncharge_info()
270 nrg->css = rg->css; in copy_hugetlb_cgroup_uncharge_info()
271 if (rg->css) in copy_hugetlb_cgroup_uncharge_info()
272 css_get(rg->css); in copy_hugetlb_cgroup_uncharge_info()
311 static void put_uncharge_info(struct file_region *rg) in put_uncharge_info() argument
314 if (rg->css) in put_uncharge_info()
315 css_put(rg->css); in put_uncharge_info()
319 static bool has_same_uncharge_info(struct file_region *rg, in has_same_uncharge_info() argument
323 return rg && org && in has_same_uncharge_info()
324 rg->reservation_counter == org->reservation_counter && in has_same_uncharge_info()
325 rg->css == org->css; in has_same_uncharge_info()
332 static void coalesce_file_region(struct resv_map *resv, struct file_region *rg) in coalesce_file_region() argument
336 prg = list_prev_entry(rg, link); in coalesce_file_region()
337 if (&prg->link != &resv->regions && prg->to == rg->from && in coalesce_file_region()
338 has_same_uncharge_info(prg, rg)) { in coalesce_file_region()
339 prg->to = rg->to; in coalesce_file_region()
341 list_del(&rg->link); in coalesce_file_region()
342 put_uncharge_info(rg); in coalesce_file_region()
343 kfree(rg); in coalesce_file_region()
345 rg = prg; in coalesce_file_region()
348 nrg = list_next_entry(rg, link); in coalesce_file_region()
349 if (&nrg->link != &resv->regions && nrg->from == rg->to && in coalesce_file_region()
350 has_same_uncharge_info(nrg, rg)) { in coalesce_file_region()
351 nrg->from = rg->from; in coalesce_file_region()
353 list_del(&rg->link); in coalesce_file_region()
354 put_uncharge_info(rg); in coalesce_file_region()
355 kfree(rg); in coalesce_file_region()
374 struct file_region *rg = NULL, *trg = NULL, *nrg = NULL; in add_reservation_in_range() local
383 list_for_each_entry_safe(rg, trg, head, link) { in add_reservation_in_range()
385 if (rg->from < f) { in add_reservation_in_range()
389 if (rg->to > last_accounted_offset) in add_reservation_in_range()
390 last_accounted_offset = rg->to; in add_reservation_in_range()
397 if (rg->from > t) in add_reservation_in_range()
403 if (rg->from > last_accounted_offset) { in add_reservation_in_range()
404 add += rg->from - last_accounted_offset; in add_reservation_in_range()
407 resv, last_accounted_offset, rg->from); in add_reservation_in_range()
410 list_add(&nrg->link, rg->link.prev); in add_reservation_in_range()
416 last_accounted_offset = rg->to; in add_reservation_in_range()
428 list_add(&nrg->link, rg->link.prev); in add_reservation_in_range()
446 struct file_region *trg = NULL, *rg = NULL; in allocate_file_region_entries() local
489 list_for_each_entry_safe(rg, trg, &allocated_regions, link) { in allocate_file_region_entries()
490 list_del(&rg->link); in allocate_file_region_entries()
491 kfree(rg); in allocate_file_region_entries()
643 struct file_region *rg, *trg; in region_del() local
649 list_for_each_entry_safe(rg, trg, head, link) { in region_del()
657 if (rg->to <= f && (rg->to != rg->from || rg->to != f)) in region_del()
660 if (rg->from >= t) in region_del()
663 if (f > rg->from && t < rg->to) { /* Must split region */ in region_del()
687 resv, rg, t - f, false); in region_del()
691 nrg->to = rg->to; in region_del()
693 copy_hugetlb_cgroup_uncharge_info(nrg, rg); in region_del()
698 rg->to = f; in region_del()
700 list_add(&nrg->link, &rg->link); in region_del()
705 if (f <= rg->from && t >= rg->to) { /* Remove entire region */ in region_del()
706 del += rg->to - rg->from; in region_del()
707 hugetlb_cgroup_uncharge_file_region(resv, rg, in region_del()
708 rg->to - rg->from, true); in region_del()
709 list_del(&rg->link); in region_del()
710 kfree(rg); in region_del()
714 if (f <= rg->from) { /* Trim beginning of region */ in region_del()
715 hugetlb_cgroup_uncharge_file_region(resv, rg, in region_del()
716 t - rg->from, false); in region_del()
718 del += t - rg->from; in region_del()
719 rg->from = t; in region_del()
721 hugetlb_cgroup_uncharge_file_region(resv, rg, in region_del()
722 rg->to - f, false); in region_del()
724 del += rg->to - f; in region_del()
725 rg->to = f; in region_del()
770 struct file_region *rg; in region_count() local
775 list_for_each_entry(rg, head, link) { in region_count()
779 if (rg->to <= f) in region_count()
781 if (rg->from >= t) in region_count()
784 seg_from = max(rg->from, f); in region_count()
785 seg_to = min(rg->to, t); in region_count()
896 struct file_region *rg = kmalloc(sizeof(*rg), GFP_KERNEL); in resv_map_alloc() local
898 if (!resv_map || !rg) { in resv_map_alloc()
900 kfree(rg); in resv_map_alloc()
918 list_add(&rg->link, &resv_map->region_cache); in resv_map_alloc()
928 struct file_region *rg, *trg; in resv_map_release() local
934 list_for_each_entry_safe(rg, trg, head, link) { in resv_map_release()
935 list_del(&rg->link); in resv_map_release()
936 kfree(rg); in resv_map_release()