[PATCH 2/2] mm: rmap: increase COMPOUND_MAPPED to support 512G HugeTLB pages

From: James Houghton
Date: Mon Mar 06 2023 - 18:00:31 EST


Some architectures may want to support 512G HugeTLB pages in the future.
Adjust COMPOUND_MAPPED to support this page size.

Signed-off-by: James Houghton <jthoughton@xxxxxxxxxx>

diff --git a/mm/internal.h b/mm/internal.h
index 400451a4dd49..994381fd5155 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -53,11 +53,11 @@ struct folio_batch;
void page_writeback_init(void);

/*
- * If a 16GB hugetlb folio were mapped by PTEs of all of its 4kB pages,
- * its nr_pages_mapped would be 0x400000: choose the COMPOUND_MAPPED bit
- * above that range, instead of 2*(PMD_SIZE/PAGE_SIZE).
+ * If a 512G hugetlb folio were mapped by PTEs of all of its 4kB pages,
+ * its nr_pages_mapped would be 2^27 (0x8000000): choose the COMPOUND_MAPPED bit
+ * above that range.
*/
-#define COMPOUND_MAPPED 0x800000
+#define COMPOUND_MAPPED (1 << 28)
#define FOLIO_PAGES_MAPPED (COMPOUND_MAPPED - 1)

/*
--
2.40.0.rc0.216.gc4246ad0f0-goog