On Tue, 10 Sep 2019 16:31:40 -0700 From: Mina Almasry <almasrymina@xxxxxxxxxx> > > @@ -3203,6 +3225,8 @@ static void hugetlb_vm_op_close(struct vm_area_struct *vma) > gbl_reserve = hugepage_subpool_put_pages(spool, reserve); > hugetlb_acct_memory(h, -gbl_reserve); > } Double thanks for cleaning up the gbl typo. > + > + kref_put(&resv->refs, resv_map_release); > } > > > @@ -4569,11 +4594,29 @@ int hugetlb_reserve_pages(struct inode *inode, > chg = region_chg(resv_map, from, to); > > } else { > + /* Private mapping. */ > + chg = to - from; > + > + if (hugetlb_cgroup_charge_cgroup( > + hstate_index(h), > + chg * pages_per_huge_page(h), > + &h_cg, true)) { > + return -ENOMEM; > + } > + > resv_map = resv_map_alloc(); > if (!resv_map) > return -ENOMEM; Put charge after allocating resv_map. Other than that Acked-by: Hillf Danton <hdanton@xxxxxxxx>