Skip to contentSkip to conversation

hugetlb: remove unnecessary set_page_count in prep_compound_gigantic_page

PATCH Applied Mike Kravetz 5 participants 5 messages Oct 26, 2021 – Oct 27, 2021

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

PATCH 1/1 hugetlb: remove unnecessary set_page_count in prep_compound_gigantic_page

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")
---
 mm/hugetlb.c | 1 -
 1 file changed, 1 deletion(-)
mm/hugetlb.c +0 -1
index 906fe8a3b93d..88047a367080 100644
@@ -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);
Signature · 1 line
2.31.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Mike Kravetz

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.

Quoted 5 lines

Remove redundant and unnecessary set_page_count call.

Fixes 7118fc2906e29 ("hugetlb: address ref count racing in prep_compound_gigantic_page")

Thanks,
Pasha

Reviewed-by on v1 1/1
#2 lore raw
In reply to Mike Kravetz
Quoted 11 lines · Mike Kravetz

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")
maintainer Reviewed-by on v1 1/1
#3 lore raw
In reply to Mike Kravetz
Quoted 11 lines · Mike Kravetz

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")
Quoted 20 lines
---
 mm/hugetlb.c | 1 -
 1 file changed, 1 deletion(-)
mm/hugetlb.c +0 -1
index 906fe8a3b93d..88047a367080 100644
@@ -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);
Signature · 1 line
2.31.1
Signature · 2 lines
Oscar Salvador
SUSE Labs
Reviewed-by on v1 1/1
#4 lore raw
In reply to Mike Kravetz
Quoted 7 lines · Mike Kravetz

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.

Quoted 5 lines

Remove redundant and unnecessary set_page_count call.

Fixes 7118fc2906e29 ("hugetlb: address ref count racing in prep_compound_gigantic_page")

Thanks.