Re: [PATCH 4/8] mm: Add __dump_folio()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 28, 2024 at 01:34:58PM -0800, SeongJae Park wrote:
>     ...linux/mm/debug.c: In function '__dump_page':
>     ...linux/include/asm-generic/pgtable-nop4d.h:11:33: error: 'PGDIR_SHIFT' undeclared (first use in this function); did you mean 'PUD_SHIFT'?
>        11 | #define P4D_SHIFT               PGDIR_SHIFT
>           |                                 ^~~~~~~~~~~
>     ...linux/include/asm-generic/pgtable-nopud.h:18:25: note: in expansion of macro 'P4D_SHIFT'
>        18 | #define PUD_SHIFT       P4D_SHIFT
>           |                         ^~~~~~~~~
>     ...linux/include/linux/pgtable.h:9:26: note: in expansion of macro 'PUD_SHIFT'
>         9 | #define PUD_ORDER       (PUD_SHIFT - PAGE_SHIFT)
>           |                          ^~~~~~~~~
>     ...linux/mm/debug.c:128:35: note: in expansion of macro 'PUD_ORDER'
>       128 |                 if (idx < (1UL << PUD_ORDER)) {

Thanks.  Can you try this?

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 49d87a4d29b9..e25e86b755be 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -2078,6 +2078,13 @@ static inline long folio_nr_pages(struct folio *folio)
 #endif
 }
 
+/* Only hugetlbfs can allocate folios larger than MAX_ORDER */
+#ifdef CONFIG_ARCH_HAS_GIGANTIC_PAGE
+#define MAX_FOLIO_NR_PAGES	(1UL << PUD_ORDER)
+#else
+#define MAX_FOLIO_NR_PAGES	MAX_ORDER_NR_PAGES
+#endif
+
 /*
  * compound_nr() returns the number of pages in this potentially compound
  * page.  compound_nr() can be called on a tail page, and is defined to
diff --git a/mm/debug.c b/mm/debug.c
index 6149944016a7..32ac7d79fd04 100644
--- a/mm/debug.c
+++ b/mm/debug.c
@@ -125,7 +125,7 @@ static void __dump_page(const struct page *page)
 	foliop = page_folio(&precise);
 	idx = folio_page_idx(foliop, page);
 	if (idx != 0) {
-		if (idx < (1UL << PUD_ORDER)) {
+		if (idx < MAX_FOLIO_NR_PAGES) {
 			memcpy(&folio, foliop, 2 * sizeof(struct page));
 			nr_pages = folio_nr_pages(&folio);
 		}




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux