diff mbox series

mm/hugetlb: remove duplicate codes of setting compound_nr

Message ID 20210203044055.89618-1-yanfei.xu@windriver.com (mailing list archive)
State New, archived
Headers show
Series mm/hugetlb: remove duplicate codes of setting compound_nr | expand

Commit Message

Xu, Yanfei Feb. 3, 2021, 4:40 a.m. UTC
From: Yanfei Xu <yanfei.xu@windriver.com>

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.

Signed-off-by: Yanfei Xu <yanfei.xu@windriver.com>
---
 mm/hugetlb.c | 1 -
 1 file changed, 1 deletion(-)

Comments

Mike Kravetz Feb. 3, 2021, 5:24 a.m. UTC | #1
On 2/2/21 8:40 PM, yanfei.xu@windriver.com wrote:
> From: Yanfei Xu <yanfei.xu@windriver.com>
> 
> 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.
> 
> Signed-off-by: Yanfei Xu <yanfei.xu@windriver.com>
> ---
>  mm/hugetlb.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index a3e4fa2c5e94..ac249b1583de 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -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.
Xu, Yanfei Feb. 3, 2021, 5:24 a.m. UTC | #2
Sorry. Please ignore this patch, it's incorrect.

Thanks,
Yanfei

On 2/3/21 12:40 PM, yanfei.xu@windriver.com wrote:
> From: Yanfei Xu <yanfei.xu@windriver.com>
> 
> 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.
> 
> Signed-off-by: Yanfei Xu <yanfei.xu@windriver.com>
> ---
>   mm/hugetlb.c | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index a3e4fa2c5e94..ac249b1583de 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -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);
>   }
>   
>
diff mbox series

Patch

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index a3e4fa2c5e94..ac249b1583de 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -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);
 }