Skip to contentSkip to conversation

mm/hugetlb: remove redundant check in preparing and destroying gigantic page

PATCH Applied [email protected] 3 participants 4 messages Feb 2, 2021 – Feb 5, 2021

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

PATCH v2 1/1 mm/hugetlb: remove redundant check in preparing and destroying gigantic page

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 the redundant check for gigantic page.

---
 mm/hugetlb.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
mm/hugetlb.c +2 -5
index a3e4fa2c5e94..dac5db569ccb 100644
@@ -1219,8 +1219,7 @@ static void destroy_compound_gigantic_page(struct page *page,
 	struct page *p = page + 1;
 
 	atomic_set(compound_mapcount_ptr(page), 0);
-	if (hpage_pincount_available(page))
-		atomic_set(compound_pincount_ptr(page), 0);
+	atomic_set(compound_pincount_ptr(page), 0);
 
 	for (i = 1; i < nr_pages; i++, p = mem_map_next(p, page, i)) {
 		clear_compound_head(p);
@@ -1501,9 +1500,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
author
#1 lore raw

I'm sorry for forgetting to add David.
Now add David :)

Thanks,
Yanfei

Quoted 37 lines · On 2/2/21 7:20 PM, [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 the redundant check for gigantic page.

---
  mm/hugetlb.c | 7 ++-----
  1 file changed, 2 insertions(+), 5 deletions(-)
mm/hugetlb.c +2 -5
index a3e4fa2c5e94..dac5db569ccb 100644
@@ -1219,8 +1219,7 @@ static void destroy_compound_gigantic_page(struct page *page,
  	struct page *p = page + 1;
 
  	atomic_set(compound_mapcount_ptr(page), 0);
-	if (hpage_pincount_available(page))
-		atomic_set(compound_pincount_ptr(page), 0);
+	atomic_set(compound_pincount_ptr(page), 0);
 
  	for (i = 1; i < nr_pages; i++, p = mem_map_next(p, page, i)) {
  		clear_compound_head(p);
@@ -1501,9 +1500,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);
  }
 
  /*
Reviewed-by
#2 lore raw
Quoted 17 lines · Yanfei

I'm sorry for forgetting to add David.
Now add David :)

Thanks,
Yanfei

Quoted 10 lines · On 2/2/21 7:20 PM, [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 the redundant check for gigantic page.

---
  mm/hugetlb.c | 7 ++-----
  1 file changed, 2 insertions(+), 5 deletions(-)

I can not imagine a 'hugetlb gigantic page' being <= 1 order, so this change makes sense. Thanks,

Signature · 1 line
Mike Kravetz
Quoted 24 lines
Quoted 23 lines
mm/hugetlb.c +2 -5
index a3e4fa2c5e94..dac5db569ccb 100644
@@ -1219,8 +1219,7 @@ static void destroy_compound_gigantic_page(struct page *page,
      struct page *p = page + 1;
        atomic_set(compound_mapcount_ptr(page), 0);
-    if (hpage_pincount_available(page))
-        atomic_set(compound_pincount_ptr(page), 0);
+    atomic_set(compound_pincount_ptr(page), 0);
        for (i = 1; i < nr_pages; i++, p = mem_map_next(p, page, i)) {
          clear_compound_head(p);
@@ -1501,9 +1500,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);
  }
    /*
 
Reviewed-by on v2 1/1
#3 lore raw
In reply to [email protected]
Quoted 27 lines · On 02.02.21 12:20, [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 the redundant check for gigantic page.

---
  mm/hugetlb.c | 7 ++-----
  1 file changed, 2 insertions(+), 5 deletions(-)
mm/hugetlb.c +1 -2
index a3e4fa2c5e94..dac5db569ccb 100644
@@ -1219,8 +1219,7 @@ static void destroy_compound_gigantic_page(struct page *page,
  	struct page *p = page + 1;
 
  	atomic_set(compound_mapcount_ptr(page), 0);
-	if (hpage_pincount_available(page))
-		atomic_set(compound_pincount_ptr(page), 0);
+	atomic_set(compound_pincount_ptr(page), 0);
 
  	for (i = 1; i < nr_pages; i++, p = mem_map_next(p, page, i)) {
  		clear_compound_head(p);

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

Quoted 10 lines
mm/hugetlb.c +1 -3
@@ -1501,9 +1500,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 · 3 lines
Thanks,

David / dhildenb