linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] mm/hugetlb: remove redundant check in preparing and destroying gigantic page
@ 2021-02-02 11:20 yanfei.xu
  2021-02-02 12:19 ` Xu, Yanfei
  2021-02-05  8:15 ` David Hildenbrand
  0 siblings, 2 replies; 4+ messages in thread
From: yanfei.xu @ 2021-02-02 11:20 UTC (permalink / raw)
  To: mike.kravetz, akpm; +Cc: linux-mm, linux-kernel

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

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

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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] mm/hugetlb: remove redundant check in preparing and destroying gigantic page
  2021-02-02 11:20 [PATCH v2] mm/hugetlb: remove redundant check in preparing and destroying gigantic page yanfei.xu
@ 2021-02-02 12:19 ` Xu, Yanfei
  2021-02-02 19:03   ` Mike Kravetz
  2021-02-05  8:15 ` David Hildenbrand
  1 sibling, 1 reply; 4+ messages in thread
From: Xu, Yanfei @ 2021-02-02 12:19 UTC (permalink / raw)
  To: mike.kravetz, akpm, David Hildenbrand; +Cc: linux-mm, linux-kernel

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

Thanks,
Yanfei

On 2/2/21 7:20 PM, 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 the
> redundant check for gigantic page.
> 
> Signed-off-by: Yanfei Xu <yanfei.xu@windriver.com>
> ---
>   mm/hugetlb.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index a3e4fa2c5e94..dac5db569ccb 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -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);
>   }
>   
>   /*
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] mm/hugetlb: remove redundant check in preparing and destroying gigantic page
  2021-02-02 12:19 ` Xu, Yanfei
@ 2021-02-02 19:03   ` Mike Kravetz
  0 siblings, 0 replies; 4+ messages in thread
From: Mike Kravetz @ 2021-02-02 19:03 UTC (permalink / raw)
  To: Xu, Yanfei, akpm, David Hildenbrand; +Cc: linux-mm, linux-kernel

On 2/2/21 4:19 AM, Xu, Yanfei wrote:
> I'm sorry for forgetting to add David.
> Now add David :)
> 
> Thanks,
> Yanfei
> 
> On 2/2/21 7:20 PM, 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 the
>> redundant check for gigantic page.
>>
>> Signed-off-by: Yanfei Xu <yanfei.xu@windriver.com>
>> ---
>>   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,

Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
-- 
Mike Kravetz

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] mm/hugetlb: remove redundant check in preparing and destroying gigantic page
  2021-02-02 11:20 [PATCH v2] mm/hugetlb: remove redundant check in preparing and destroying gigantic page yanfei.xu
  2021-02-02 12:19 ` Xu, Yanfei
@ 2021-02-05  8:15 ` David Hildenbrand
  1 sibling, 0 replies; 4+ messages in thread
From: David Hildenbrand @ 2021-02-05  8:15 UTC (permalink / raw)
  To: yanfei.xu, mike.kravetz, akpm; +Cc: linux-mm, linux-kernel

On 02.02.21 12:20, 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 the
> redundant check for gigantic page.
> 
> Signed-off-by: Yanfei Xu <yanfei.xu@windriver.com>
> ---
>   mm/hugetlb.c | 7 ++-----
>   1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index a3e4fa2c5e94..dac5db569ccb 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -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: David Hildenbrand <david@redhat.com>

-- 
Thanks,

David / dhildenb



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-02-05  8:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-02 11:20 [PATCH v2] mm/hugetlb: remove redundant check in preparing and destroying gigantic page yanfei.xu
2021-02-02 12:19 ` Xu, Yanfei
2021-02-02 19:03   ` Mike Kravetz
2021-02-05  8:15 ` David Hildenbrand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).