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

Message ID 20230306230004.1387007-3-jthoughton@google.com
State New
Headers
Series mm: rmap: merge HugeTLB mapcount logic with THPs |

Commit Message

James Houghton March 6, 2023, 11 p.m. UTC
  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@google.com>
  

Patch

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)
 
 /*