Skip to contentSkip to conversation

mm/hugetlb.c: just use put_page_testzero() instead of page_count()

PATCH Applied Hui Su 1 participant 1 message Oct 7, 2020

Subsystems (2)
lore
Share & tools
lore

Hui Su

author
#0 lore raw

PATCH 1/1 mm/hugetlb.c: just use put_page_testzero() instead of page_count()

we test the page reference count is zero or not here, it can be a bug here if page refercence count is not zero. So we can just use put_page_testzero() instead of page_count().

---
 mm/hugetlb.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
mm/hugetlb.c +1 -2
index 67fc6383995b..a274b9ac466f 100644
@@ -2105,8 +2105,7 @@ static int gather_surplus_pages(struct hstate *h, int delta)
 		 * This page is now managed by the hugetlb allocator and has
 		 * no users -- drop the buddy allocator's reference.
 		 */
-		put_page_testzero(page);
-		VM_BUG_ON_PAGE(page_count(page), page);
+		VM_BUG_ON_PAGE(!put_page_testzero(page), page);
 		enqueue_huge_page(h, page);
 	}
 free:
Signature · 1 line
2.25.1