diff mbox series

[1/5] mm/hugetlb.c: Fix typo of glb_reserve

Message ID 20200720062623.13135-2-bhe@redhat.com (mailing list archive)
State New, archived
Headers show
Series mm/hugetlb: Small cleanup and improvement | expand

Commit Message

Baoquan He July 20, 2020, 6:26 a.m. UTC
The local variable is for global reservation of region.

Signed-off-by: Baoquan He <bhe@redhat.com>
---
 mm/hugetlb.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

Comments

Mike Kravetz July 20, 2020, 10:32 p.m. UTC | #1
On 7/19/20 11:26 PM, Baoquan He wrote:
> The local variable is for global reservation of region.
> 
> Signed-off-by: Baoquan He <bhe@redhat.com>
> ---
>  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;

I see both 'gbl' and 'glb' being used for global in variable names.  grep will
actually return more hits for gbl than glb.  Unless there is consensus that
'glb' should be used for global, I would prefer not to make this change.
Baoquan He July 21, 2020, 9:17 a.m. UTC | #2
On 07/20/20 at 03:32pm, Mike Kravetz wrote:
> On 7/19/20 11:26 PM, Baoquan He wrote:
> > The local variable is for global reservation of region.
> > 
> > Signed-off-by: Baoquan He <bhe@redhat.com>
> > ---
> >  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;
> 
> I see both 'gbl' and 'glb' being used for global in variable names.  grep will
> actually return more hits for gbl than glb.  Unless there is consensus that
> 'glb' should be used for global, I would prefer not to make this change.

Ah, I thought it's typo, so it's just another kind of abbreviation. Then
I am fine to drop this patch.

Thanks a lot for careful reviewing on this patchset.

Thanks
Baoquan
diff mbox series

Patch

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;
 }