Skip to contentSkip to conversation

mm/hugetlb: remove a meaningless if statement in gigantic page initialization

PATCH In review [email protected] 2 participants 3 messages Feb 2, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm/hugetlb: remove a meaningless if statement in gigantic page initialization

From: Yanfei Xu <[email protected]>

Gigantic page is a compound page and its order is more than 1. Thus it must be available for hpage_pincount. Let's remove this meaningless if statement.

---
 mm/hugetlb.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
mm/hugetlb.c +1 -3
index a3e4fa2c5e94..73d602f8c7e2 100644
@@ -1501,9 +1501,7 @@ static void prep_compound_gigantic_page(struct page *page, unsigned int order)
 		set_compound_head(p, page);
 	}
 	atomic_set(compound_mapcount_ptr(page), -1);
-
-	if (hpage_pincount_available(page))
-		atomic_set(compound_pincount_ptr(page), 0);
+	atomic_set(compound_pincount_ptr(page), 0);
 }
 
 /*
Signature · 1 line
2.27.0
#1 lore raw
Quoted 17 lines · On 02.02.21 11:12, [email protected] wrote:

From: Yanfei Xu <[email protected]>

Gigantic page is a compound page and its order is more than 1. Thus it must be available for hpage_pincount. Let's remove this meaningless if statement.

---
  mm/hugetlb.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)
mm/hugetlb.c +0 -0
index a3e4fa2c5e94..73d602f8c7e2 100644

mm/hugetlb.c static void prep_compound_gigantic_page(struct page *page, unsigned int order) · line 1507

Quoted 10 lines
mm/hugetlb.c +1 -3
@@ -1501,9 +1501,7 @@ static void prep_compound_gigantic_page(struct page *page, unsigned int order)
  		set_compound_head(p, page);
  	}
  	atomic_set(compound_mapcount_ptr(page), -1);
-
-	if (hpage_pincount_available(page))
-		atomic_set(compound_pincount_ptr(page), 0);
+	atomic_set(compound_pincount_ptr(page), 0);
  }
 
  /*

I can spot similar handling in destroy_compound_gigantic_page(). If this is correct (which I think it is), we should tackle both occurrences at once.

Signature · 3 lines
Thanks,

David / dhildenb
author
#2 lore raw
Quoted 29 lines · David Hildenbrand

[Please note: This e-mail is from an EXTERNAL e-mail address]

Quoted 26 lines · On 02.02.21 11:12, [email protected] wrote:

From: Yanfei Xu <[email protected]>

Gigantic page is a compound page and its order is more than 1. Thus it must be available for hpage_pincount. Let's remove this meaningless if statement.

---
  mm/hugetlb.c | 4 +---

  1 file changed, 1 insertion(+), 3 deletions(-)
mm/hugetlb.c +1 -3
index a3e4fa2c5e94..73d602f8c7e2 100644
@@ -1501,9 +1501,7 @@ static void prep_compound_gigantic_page(struct 
 page *page, unsigned int order)
               set_compound_head(p, page);
       }
       atomic_set(compound_mapcount_ptr(page), -1);
-
-     if (hpage_pincount_available(page))
-             atomic_set(compound_pincount_ptr(page), 0);
+     atomic_set(compound_pincount_ptr(page), 0);
   }
 
Quoted 6 lines
Quoted 2 lines

  /*

I can spot similar handling in destroy_compound_gigantic_page(). If this is correct (which I think it is), we should tackle both occurrences at once.

Agree. Will do it in v2.

Thanks,
Yanfei

Quoted 5 lines
Signature · 3 lines
Thanks,

David / dhildenb