Skip to contentSkip to conversation

mm/hugetlb: remove duplicate codes of setting compound_nr

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

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

PATCH 1/1 mm/hugetlb: remove duplicate codes of setting compound_nr

From: Yanfei Xu <[email protected]>

set_compound_order() set both of page's compound_order and compound_nr. It's no need to assign to compound_nr again, so remove it.

---
 mm/hugetlb.c | 1 -
 1 file changed, 1 deletion(-)
mm/hugetlb.c +0 -1
index a3e4fa2c5e94..ac249b1583de 100644
@@ -1228,7 +1228,6 @@ static void destroy_compound_gigantic_page(struct page *page,
 	}
 
 	set_compound_order(page, 0);
-	page[1].compound_nr = 0;
 	__ClearPageHead(page);
 }
 
Signature · 1 line
2.27.0
#1 lore raw
Quoted 16 lines · On 2/2/21 8:40 PM, [email protected] wrote:

From: Yanfei Xu <[email protected]>

set_compound_order() set both of page's compound_order and compound_nr. It's no need to assign to compound_nr again, so remove it.

---
 mm/hugetlb.c | 1 -
 1 file changed, 1 deletion(-)
mm/hugetlb.c +0 -0
index a3e4fa2c5e94..ac249b1583de 100644

mm/hugetlb.c static void destroy_compound_gigantic_page(struct page *page, · line 1231

Quoted 4 lines
mm/hugetlb.c +0 -1
@@ -1228,7 +1228,6 @@ static void destroy_compound_gigantic_page(struct page *page,
 	}
 
 	set_compound_order(page, 0);
-	page[1].compound_nr = 0;

I may be reading the code wrong, but set_compound_order(page, 0) will set page[1].compound_nr to the value of 1. That is different than the explicit setting to 0 in the existing code.

If that is correct, then you should say why the explicit assignment is not necessary.

Signature · 1 line
Mike Kravetz
Quoted 4 lines
mm/hugetlb.c +0 -0
 	__ClearPageHead(page);
 }
 
author
#2 lore raw
In reply to [email protected]

Sorry. Please ignore this patch, it's incorrect.

Thanks,
Yanfei

Quoted 24 lines · On 2/3/21 12:40 PM, [email protected] wrote:

From: Yanfei Xu <[email protected]>

set_compound_order() set both of page's compound_order and compound_nr. It's no need to assign to compound_nr again, so remove it.

---
  mm/hugetlb.c | 1 -
  1 file changed, 1 deletion(-)
mm/hugetlb.c +0 -1
index a3e4fa2c5e94..ac249b1583de 100644
@@ -1228,7 +1228,6 @@ static void destroy_compound_gigantic_page(struct page *page,
  	}
 
  	set_compound_order(page, 0);
-	page[1].compound_nr = 0;
  	__ClearPageHead(page);
  }