[PATCH v2 08/10] hugetlb: add comment for subtle SetHPageVmemmapOptimized()

Miaohe Lin posted 10 patches 3 years, 7 months ago
[PATCH v2 08/10] hugetlb: add comment for subtle SetHPageVmemmapOptimized()
Posted by Miaohe Lin 3 years, 7 months ago
The SetHPageVmemmapOptimized() called here seems unnecessary as it's
assumed to be set when calling this function. But it's indeed cleared
by above set_page_private(page, 0). Add a comment to avoid possible
future confusion.

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Reviewed-by: Muchun Song <songmuchun@bytedance.com>
---
 mm/hugetlb.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 26bcc85715eb..2ba45addcdeb 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -1520,6 +1520,10 @@ static void add_hugetlb_page(struct hstate *h, struct page *page,
 
 	set_compound_page_dtor(page, HUGETLB_PAGE_DTOR);
 	set_page_private(page, 0);
+	/*
+	 * We have to set HPageVmemmapOptimized again as above
+	 * set_page_private(page, 0) cleared it.
+	 */
 	SetHPageVmemmapOptimized(page);
 
 	/*
-- 
2.23.0