The local variable is for global reservation of region. Signed-off-by: Baoquan He <bhe@xxxxxxxxxx> --- mm/hugetlb.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index f24acb3af741..191a585bb315 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -3649,7 +3649,7 @@ static void hugetlb_vm_op_close(struct vm_area_struct *vma) struct resv_map *resv = vma_resv_map(vma); struct hugepage_subpool *spool = subpool_vma(vma); unsigned long reserve, start, end; - long gbl_reserve; + long glb_reserve; if (!resv || !is_vma_resv_set(vma, HPAGE_RESV_OWNER)) return; @@ -3664,8 +3664,8 @@ static void hugetlb_vm_op_close(struct vm_area_struct *vma) * Decrement reserve counts. The global reserve count may be * adjusted if the subpool has a minimum size. */ - gbl_reserve = hugepage_subpool_put_pages(spool, reserve); - hugetlb_acct_memory(h, -gbl_reserve); + glb_reserve = hugepage_subpool_put_pages(spool, reserve); + hugetlb_acct_memory(h, -glb_reserve); } kref_put(&resv->refs, resv_map_release); @@ -5054,7 +5054,7 @@ int hugetlb_reserve_pages(struct inode *inode, struct hugepage_subpool *spool = subpool_inode(inode); struct resv_map *resv_map; struct hugetlb_cgroup *h_cg = NULL; - long gbl_reserve, regions_needed = 0; + long glb_reserve, regions_needed = 0; /* This should never happen */ if (from > to) { @@ -5121,10 +5121,10 @@ int hugetlb_reserve_pages(struct inode *inode, /* * There must be enough pages in the subpool for the mapping. If * the subpool has a minimum size, there may be some global - * reservations already in place (gbl_reserve). + * reservations already in place (glb_reserve). */ - gbl_reserve = hugepage_subpool_get_pages(spool, chg); - if (gbl_reserve < 0) { + glb_reserve = hugepage_subpool_get_pages(spool, chg); + if (glb_reserve < 0) { ret = -ENOSPC; goto out_uncharge_cgroup; } @@ -5133,7 +5133,7 @@ int hugetlb_reserve_pages(struct inode *inode, * Check enough hugepages are available for the reservation. * Hand the pages back to the subpool if there are not */ - ret = hugetlb_acct_memory(h, gbl_reserve); + ret = hugetlb_acct_memory(h, glb_reserve); if (ret < 0) { goto out_put_pages; } @@ -5153,7 +5153,7 @@ int hugetlb_reserve_pages(struct inode *inode, add = region_add(resv_map, from, to, regions_needed, h, h_cg); if (unlikely(add < 0)) { - hugetlb_acct_memory(h, -gbl_reserve); + hugetlb_acct_memory(h, -glb_reserve); goto out_put_pages; } else if (unlikely(chg > add)) { /* @@ -5200,7 +5200,7 @@ long hugetlb_unreserve_pages(struct inode *inode, long start, long end, struct resv_map *resv_map = inode_resv_map(inode); long chg = 0; struct hugepage_subpool *spool = subpool_inode(inode); - long gbl_reserve; + long glb_reserve; /* * Since this routine can be called in the evict inode path for all @@ -5225,8 +5225,8 @@ long hugetlb_unreserve_pages(struct inode *inode, long start, long end, * If the subpool has a minimum size, the number of global * reservations to be released may be adjusted. */ - gbl_reserve = hugepage_subpool_put_pages(spool, (chg - freed)); - hugetlb_acct_memory(h, -gbl_reserve); + glb_reserve = hugepage_subpool_put_pages(spool, (chg - freed)); + hugetlb_acct_memory(h, -glb_reserve); return 0; } -- 2.17.2