linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hugetlb: remove unnecessary set_page_count in prep_compound_gigantic_page
@ 2021-10-26 22:06 Mike Kravetz
  2021-10-26 22:22 ` Pasha Tatashin
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Mike Kravetz @ 2021-10-26 22:06 UTC (permalink / raw)
  To: linux-mm, linux-kernel
  Cc: Matthew Wilcox, Muchun Song, Andrew Morton, Mike Kravetz, Pasha Tatashin

In commit 7118fc2906e29 ("hugetlb: address ref count racing in
prep_compound_gigantic_page"), page_ref_freeze is used to atomically
zero the ref count of tail pages iff they are 1.  The unconditional
call to set_page_count(0) was left in the code.  This call is after
page_ref_freeze so it is really a noop.

Remove redundant and unnecessary set_page_count call.

Fixes: 7118fc2906e29 ("hugetlb: address ref count racing in prep_compound_gigantic_page")
Suggested-by: Pasha Tatashin <pasha.tatashin@soleen.com>
Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>
---
 mm/hugetlb.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 906fe8a3b93d..88047a367080 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1795,7 +1795,6 @@ static bool __prep_compound_gigantic_page(struct page *page, unsigned int order,
 		} else {
 			VM_BUG_ON_PAGE(page_count(p), p);
 		}
-		set_page_count(p, 0);
 		set_compound_head(p, page);
 	}
 	atomic_set(compound_mapcount_ptr(page), -1);
-- 
2.31.1



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

* Re: [PATCH] hugetlb: remove unnecessary set_page_count in prep_compound_gigantic_page
  2021-10-26 22:06 [PATCH] hugetlb: remove unnecessary set_page_count in prep_compound_gigantic_page Mike Kravetz
@ 2021-10-26 22:22 ` Pasha Tatashin
  2021-10-26 23:49 ` Matthew Wilcox
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Pasha Tatashin @ 2021-10-26 22:22 UTC (permalink / raw)
  To: Mike Kravetz; +Cc: linux-mm, LKML, Matthew Wilcox, Muchun Song, Andrew Morton

On Tue, Oct 26, 2021 at 6:06 PM Mike Kravetz <mike.kravetz@oracle.com> wrote:
>
> In commit 7118fc2906e29 ("hugetlb: address ref count racing in
> prep_compound_gigantic_page"), page_ref_freeze is used to atomically
> zero the ref count of tail pages iff they are 1.  The unconditional
> call to set_page_count(0) was left in the code.  This call is after
> page_ref_freeze so it is really a noop.
>
> Remove redundant and unnecessary set_page_count call.
>
> Fixes: 7118fc2906e29 ("hugetlb: address ref count racing in prep_compound_gigantic_page")
> Suggested-by: Pasha Tatashin <pasha.tatashin@soleen.com>
> Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>

Reviewed-by: Pasha Tatashin <pasha.tatashin@soleen.com>

Thanks,
Pasha


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

* Re: [PATCH] hugetlb: remove unnecessary set_page_count in prep_compound_gigantic_page
  2021-10-26 22:06 [PATCH] hugetlb: remove unnecessary set_page_count in prep_compound_gigantic_page Mike Kravetz
  2021-10-26 22:22 ` Pasha Tatashin
@ 2021-10-26 23:49 ` Matthew Wilcox
  2021-10-27  5:52 ` Oscar Salvador
  2021-10-27  6:57 ` Muchun Song
  3 siblings, 0 replies; 5+ messages in thread
From: Matthew Wilcox @ 2021-10-26 23:49 UTC (permalink / raw)
  To: Mike Kravetz
  Cc: linux-mm, linux-kernel, Muchun Song, Andrew Morton, Pasha Tatashin

On Tue, Oct 26, 2021 at 03:06:35PM -0700, Mike Kravetz wrote:
> In commit 7118fc2906e29 ("hugetlb: address ref count racing in
> prep_compound_gigantic_page"), page_ref_freeze is used to atomically
> zero the ref count of tail pages iff they are 1.  The unconditional
> call to set_page_count(0) was left in the code.  This call is after
> page_ref_freeze so it is really a noop.
> 
> Remove redundant and unnecessary set_page_count call.
> 
> Fixes: 7118fc2906e29 ("hugetlb: address ref count racing in prep_compound_gigantic_page")
> Suggested-by: Pasha Tatashin <pasha.tatashin@soleen.com>
> Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>

Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>


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

* Re: [PATCH] hugetlb: remove unnecessary set_page_count in prep_compound_gigantic_page
  2021-10-26 22:06 [PATCH] hugetlb: remove unnecessary set_page_count in prep_compound_gigantic_page Mike Kravetz
  2021-10-26 22:22 ` Pasha Tatashin
  2021-10-26 23:49 ` Matthew Wilcox
@ 2021-10-27  5:52 ` Oscar Salvador
  2021-10-27  6:57 ` Muchun Song
  3 siblings, 0 replies; 5+ messages in thread
From: Oscar Salvador @ 2021-10-27  5:52 UTC (permalink / raw)
  To: Mike Kravetz
  Cc: linux-mm, linux-kernel, Matthew Wilcox, Muchun Song,
	Andrew Morton, Pasha Tatashin

On Tue, Oct 26, 2021 at 03:06:35PM -0700, Mike Kravetz wrote:
> In commit 7118fc2906e29 ("hugetlb: address ref count racing in
> prep_compound_gigantic_page"), page_ref_freeze is used to atomically
> zero the ref count of tail pages iff they are 1.  The unconditional
> call to set_page_count(0) was left in the code.  This call is after
> page_ref_freeze so it is really a noop.
> 
> Remove redundant and unnecessary set_page_count call.
> 
> Fixes: 7118fc2906e29 ("hugetlb: address ref count racing in prep_compound_gigantic_page")
> Suggested-by: Pasha Tatashin <pasha.tatashin@soleen.com>
> Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>

Reviewed-by: Oscar Salvador <osalvador@suse.de>

> ---
>  mm/hugetlb.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 906fe8a3b93d..88047a367080 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -1795,7 +1795,6 @@ static bool __prep_compound_gigantic_page(struct page *page, unsigned int order,
>  		} else {
>  			VM_BUG_ON_PAGE(page_count(p), p);
>  		}
> -		set_page_count(p, 0);
>  		set_compound_head(p, page);
>  	}
>  	atomic_set(compound_mapcount_ptr(page), -1);
> -- 
> 2.31.1
> 
> 

-- 
Oscar Salvador
SUSE Labs


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

* Re: [PATCH] hugetlb: remove unnecessary set_page_count in prep_compound_gigantic_page
  2021-10-26 22:06 [PATCH] hugetlb: remove unnecessary set_page_count in prep_compound_gigantic_page Mike Kravetz
                   ` (2 preceding siblings ...)
  2021-10-27  5:52 ` Oscar Salvador
@ 2021-10-27  6:57 ` Muchun Song
  3 siblings, 0 replies; 5+ messages in thread
From: Muchun Song @ 2021-10-27  6:57 UTC (permalink / raw)
  To: Mike Kravetz
  Cc: Linux Memory Management List, LKML, Matthew Wilcox,
	Andrew Morton, Pasha Tatashin

On Wed, Oct 27, 2021 at 6:06 AM Mike Kravetz <mike.kravetz@oracle.com> wrote:
>
> In commit 7118fc2906e29 ("hugetlb: address ref count racing in
> prep_compound_gigantic_page"), page_ref_freeze is used to atomically
> zero the ref count of tail pages iff they are 1.  The unconditional
> call to set_page_count(0) was left in the code.  This call is after
> page_ref_freeze so it is really a noop.
>
> Remove redundant and unnecessary set_page_count call.
>
> Fixes: 7118fc2906e29 ("hugetlb: address ref count racing in prep_compound_gigantic_page")
> Suggested-by: Pasha Tatashin <pasha.tatashin@soleen.com>
> Signed-off-by: Mike Kravetz <mike.kravetz@oracle.com>

Reviewed-by: Muchun Song <songmuchun@bytedance.com>

Thanks.


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

end of thread, other threads:[~2021-10-27  6:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-26 22:06 [PATCH] hugetlb: remove unnecessary set_page_count in prep_compound_gigantic_page Mike Kravetz
2021-10-26 22:22 ` Pasha Tatashin
2021-10-26 23:49 ` Matthew Wilcox
2021-10-27  5:52 ` Oscar Salvador
2021-10-27  6:57 ` Muchun Song

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).