Skip to contentSkip to conversation

mm, hugetlb: Increment the number of pages to be reset on HVO

PATCH Applied Oscar Salvador 3 participants 3 messages Apr 15, 2025

Subsystems (2)
lore
Share & tools
lore

Oscar Salvador

author maintainer
#0 lore raw

PATCH 1/1 mm, hugetlb: Increment the number of pages to be reset on HVO

commit 4eeec8c89a0c ("mm: move hugetlb specific things in folio to page[3]") shifted hugetlb specific stuff, and now mapping overlaps _hugetlb_cgroup field.

Upon restoring the vmemmap for HVO, only the first two tail pages are reset, and this causes the check in free_tail_page_prepare() to fail as it finds an unexpected mapping value in some tails.

Increment the number of pages to be reset to 4 (head + 3 tail pages)

Fixes 4eeec8c89a0c ("mm: move hugetlb specific things in folio to page[3]")
---
 mm/hugetlb_vmemmap.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
mm/hugetlb_vmemmap.c +3 -3
index 9a99dfa3c495..27245e86df25 100644
@@ -238,11 +238,11 @@ static void vmemmap_remap_pte(pte_t *pte, unsigned long addr,
  * struct page, the special metadata (e.g. page->flags or page->mapping)
  * cannot copy to the tail struct page structs. The invalid value will be
  * checked in the free_tail_page_prepare(). In order to avoid the message
- * of "corrupted mapping in tail page". We need to reset at least 3 (one
- * head struct page struct and two tail struct page structs) struct page
+ * of "corrupted mapping in tail page". We need to reset at least 4 (one
+ * head struct page struct and three tail struct page structs) struct page
  * structs.
  */
-#define NR_RESET_STRUCT_PAGE		3
+#define NR_RESET_STRUCT_PAGE		4
 
 static inline void reset_struct_pages(struct page *start)
 {
Signature · 1 line
2.49.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 25 lines · Oscar Salvador

commit 4eeec8c89a0c ("mm: move hugetlb specific things in folio to page[3]") shifted hugetlb specific stuff, and now mapping overlaps _hugetlb_cgroup field.

Upon restoring the vmemmap for HVO, only the first two tail pages are reset, and this causes the check in free_tail_page_prepare() to fail as it finds an unexpected mapping value in some tails.

Increment the number of pages to be reset to 4 (head + 3 tail pages)

Fixes 4eeec8c89a0c ("mm: move hugetlb specific things in folio to page[3]")
---
  mm/hugetlb_vmemmap.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
mm/hugetlb_vmemmap.c +0 -1
index 9a99dfa3c495..27245e86df25 100644
@@ -238,11 +238,11 @@ static void vmemmap_remap_pte(pte_t *pte, unsigned long addr,
   * struct page, the special metadata (e.g. page->flags or page->mapping)
   * cannot copy to the tail struct page structs. The invalid value will be
   * checked in the free_tail_page_prepare(). In order to avoid the message
- * of "corrupted mapping in tail page". We need to reset at least 3 (one

mm/hugetlb_vmemmap.c static void vmemmap_remap_pte(pte_t *pte, unsigned long addr, · line 248

Quoted 10 lines
mm/hugetlb_vmemmap.c +3 -2
- * head struct page struct and two tail struct page structs) struct page
+ * of "corrupted mapping in tail page". We need to reset at least 4 (one
+ * head struct page struct and three tail struct page structs) struct page
   * structs.
   */
-#define NR_RESET_STRUCT_PAGE		3
+#define NR_RESET_STRUCT_PAGE		4
 
  static inline void reset_struct_pages(struct page *start)
  {

Thanks!

Signature · 3 lines
Cheers,

David / dhildenb
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to Oscar Salvador
Quoted 11 lines · Oscar Salvador

commit 4eeec8c89a0c ("mm: move hugetlb specific things in folio to page[3]") shifted hugetlb specific stuff, and now mapping overlaps _hugetlb_cgroup field.

Upon restoring the vmemmap for HVO, only the first two tail pages are reset, and this causes the check in free_tail_page_prepare() to fail as it finds an unexpected mapping value in some tails.

Quoted 5 lines

Increment the number of pages to be reset to 4 (head + 3 tail pages)

Fixes 4eeec8c89a0c ("mm: move hugetlb specific things in folio to page[3]")

Thanks.