diff mbox series

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

Message ID 20210202101209.72795-1-yanfei.xu@windriver.com (mailing list archive)
State New, archived
Headers show
Series mm/hugetlb: remove a meaningless if statement in gigantic page initialization | expand

Commit Message

Xu, Yanfei Feb. 2, 2021, 10:12 a.m. UTC
From: Yanfei Xu <yanfei.xu@windriver.com>

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.

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

Comments

David Hildenbrand Feb. 2, 2021, 10:06 a.m. UTC | #1
On 02.02.21 11:12, yanfei.xu@windriver.com wrote:
> From: Yanfei Xu <yanfei.xu@windriver.com>
> 
> 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.
> 
> Signed-off-by: Yanfei Xu <yanfei.xu@windriver.com>
> ---
>   mm/hugetlb.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index a3e4fa2c5e94..73d602f8c7e2 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -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.
Xu, Yanfei Feb. 2, 2021, 10:19 a.m. UTC | #2
On 2/2/21 6:06 PM, David Hildenbrand wrote:
> [Please note: This e-mail is from an EXTERNAL e-mail address]
> 
> On 02.02.21 11:12, yanfei.xu@windriver.com wrote:
>> From: Yanfei Xu <yanfei.xu@windriver.com>
>>
>> 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.
>>
>> Signed-off-by: Yanfei Xu <yanfei.xu@windriver.com>
>> ---
>>   mm/hugetlb.c | 4 +---
>>   1 file changed, 1 insertion(+), 3 deletions(-)
>>
>> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
>> index a3e4fa2c5e94..73d602f8c7e2 100644
>> --- a/mm/hugetlb.c
>> +++ b/mm/hugetlb.c
>> @@ -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.
> 
Agree. Will do it in v2.

Thanks,
Yanfei
> -- 
> Thanks,
> 
> David / dhildenb
>
diff mbox series

Patch

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