• Home
  • Raw
  • Download

Lines Matching refs:resv

252 get_file_region_entry_from_cache(struct resv_map *resv, long from, long to)  in get_file_region_entry_from_cache()  argument
256 VM_BUG_ON(resv->region_cache_count <= 0); in get_file_region_entry_from_cache()
258 resv->region_cache_count--; in get_file_region_entry_from_cache()
259 nrg = list_first_entry(&resv->region_cache, struct file_region, link); in get_file_region_entry_from_cache()
282 struct resv_map *resv, in record_hugetlb_cgroup_uncharge_info() argument
301 if (!resv->pages_per_hpage) in record_hugetlb_cgroup_uncharge_info()
302 resv->pages_per_hpage = pages_per_huge_page(h); in record_hugetlb_cgroup_uncharge_info()
306 VM_BUG_ON(resv->pages_per_hpage != pages_per_huge_page(h)); in record_hugetlb_cgroup_uncharge_info()
335 static void coalesce_file_region(struct resv_map *resv, struct file_region *rg) in coalesce_file_region() argument
340 if (&prg->link != &resv->regions && prg->to == rg->from && in coalesce_file_region()
352 if (&nrg->link != &resv->regions && nrg->from == rg->to && in coalesce_file_region()
388 static long add_reservation_in_range(struct resv_map *resv, long f, long t, in add_reservation_in_range() argument
393 struct list_head *head = &resv->regions; in add_reservation_in_range()
425 add += hugetlb_resv_map_add(resv, rg, in add_reservation_in_range()
437 add += hugetlb_resv_map_add(resv, rg, last_accounted_offset, in add_reservation_in_range()
446 static int allocate_file_region_entries(struct resv_map *resv, in allocate_file_region_entries() argument
448 __must_hold(&resv->lock) in allocate_file_region_entries()
467 while (resv->region_cache_count < in allocate_file_region_entries()
468 (resv->adds_in_progress + regions_needed)) { in allocate_file_region_entries()
469 to_allocate = resv->adds_in_progress + regions_needed - in allocate_file_region_entries()
470 resv->region_cache_count; in allocate_file_region_entries()
476 VM_BUG_ON(resv->region_cache_count < resv->adds_in_progress); in allocate_file_region_entries()
478 spin_unlock(&resv->lock); in allocate_file_region_entries()
486 spin_lock(&resv->lock); in allocate_file_region_entries()
488 list_splice(&allocated_regions, &resv->region_cache); in allocate_file_region_entries()
489 resv->region_cache_count += to_allocate; in allocate_file_region_entries()
519 static long region_add(struct resv_map *resv, long f, long t, in region_add() argument
525 spin_lock(&resv->lock); in region_add()
529 add_reservation_in_range(resv, f, t, NULL, NULL, in region_add()
542 resv->region_cache_count < in region_add()
543 resv->adds_in_progress + in region_add()
551 resv, actual_regions_needed - in_regions_needed)) { in region_add()
558 add = add_reservation_in_range(resv, f, t, h_cg, h, NULL); in region_add()
560 resv->adds_in_progress -= in_regions_needed; in region_add()
562 spin_unlock(&resv->lock); in region_add()
586 static long region_chg(struct resv_map *resv, long f, long t, in region_chg() argument
591 spin_lock(&resv->lock); in region_chg()
594 chg = add_reservation_in_range(resv, f, t, NULL, NULL, in region_chg()
600 if (allocate_file_region_entries(resv, *out_regions_needed)) in region_chg()
603 resv->adds_in_progress += *out_regions_needed; in region_chg()
605 spin_unlock(&resv->lock); in region_chg()
622 static void region_abort(struct resv_map *resv, long f, long t, in region_abort() argument
625 spin_lock(&resv->lock); in region_abort()
626 VM_BUG_ON(!resv->region_cache_count); in region_abort()
627 resv->adds_in_progress -= regions_needed; in region_abort()
628 spin_unlock(&resv->lock); in region_abort()
645 static long region_del(struct resv_map *resv, long f, long t) in region_del() argument
647 struct list_head *head = &resv->regions; in region_del()
653 spin_lock(&resv->lock); in region_del()
674 resv->region_cache_count > resv->adds_in_progress) { in region_del()
675 nrg = list_first_entry(&resv->region_cache, in region_del()
679 resv->region_cache_count--; in region_del()
683 spin_unlock(&resv->lock); in region_del()
692 resv, rg, t - f, false); in region_del()
712 hugetlb_cgroup_uncharge_file_region(resv, rg, in region_del()
720 hugetlb_cgroup_uncharge_file_region(resv, rg, in region_del()
726 hugetlb_cgroup_uncharge_file_region(resv, rg, in region_del()
734 spin_unlock(&resv->lock); in region_del()
772 static long region_count(struct resv_map *resv, long f, long t) in region_count() argument
774 struct list_head *head = &resv->regions; in region_count()
778 spin_lock(&resv->lock); in region_count()
794 spin_unlock(&resv->lock); in region_count()
2398 struct resv_map *resv; in __vma_reservation_common() local
2403 resv = vma_resv_map(vma); in __vma_reservation_common()
2404 if (!resv) in __vma_reservation_common()
2410 ret = region_chg(resv, idx, idx + 1, &dummy_out_regions_needed); in __vma_reservation_common()
2418 ret = region_add(resv, idx, idx + 1, 1, NULL, NULL); in __vma_reservation_common()
2423 region_abort(resv, idx, idx + 1, 1); in __vma_reservation_common()
2428 ret = region_add(resv, idx, idx + 1, 1, NULL, NULL); in __vma_reservation_common()
2432 region_abort(resv, idx, idx + 1, 1); in __vma_reservation_common()
2433 ret = region_del(resv, idx, idx + 1); in __vma_reservation_common()
2438 region_abort(resv, idx, idx + 1, 1); in __vma_reservation_common()
2439 ret = region_del(resv, idx, idx + 1); in __vma_reservation_common()
2441 ret = region_add(resv, idx, idx + 1, 1, NULL, NULL); in __vma_reservation_common()
4120 struct resv_map *resv = vma_resv_map(vma); in hugetlb_vm_op_open() local
4130 if (resv && is_vma_resv_set(vma, HPAGE_RESV_OWNER)) { in hugetlb_vm_op_open()
4131 resv_map_dup_hugetlb_cgroup_uncharge_info(resv); in hugetlb_vm_op_open()
4132 kref_get(&resv->refs); in hugetlb_vm_op_open()
4139 struct resv_map *resv = vma_resv_map(vma); in hugetlb_vm_op_close() local
4144 if (!resv || !is_vma_resv_set(vma, HPAGE_RESV_OWNER)) in hugetlb_vm_op_close()
4150 reserve = (end - start) - region_count(resv, start, end); in hugetlb_vm_op_close()
4151 hugetlb_cgroup_uncharge_counter(resv, start, end); in hugetlb_vm_op_close()
4161 kref_put(&resv->refs, resv_map_release); in hugetlb_vm_op_close()