diff mbox series

[RFC,v2,16/30] mm: debug: adapt dump_page to PUD THP.

Message ID 20200928175428.4110504-17-zi.yan@sent.com (mailing list archive)
State New, archived
Headers show
Series 1GB PUD THP support on x86_64 | expand

Commit Message

Zi Yan Sept. 28, 2020, 5:54 p.m. UTC
From: Zi Yan <ziy@nvidia.com>

Since the order of a PUD THP is greater than MAX_ORDER, do not consider
its tail pages corrupted. Also print sub_compound_mapcount when dumping
a PMDPageInPUD.

Signed-off-by: Zi Yan <ziy@nvidia.com>
---
 mm/debug.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/mm/debug.c b/mm/debug.c
index ccca576b2899..f5b035dc620d 100644
--- a/mm/debug.c
+++ b/mm/debug.c
@@ -68,7 +68,9 @@  void __dump_page(struct page *page, const char *reason)
 		goto hex_only;
 	}
 
-	if (page < head || (page >= head + MAX_ORDER_NR_PAGES)) {
+	if (page < head ||
+	    (page >= head + max_t(unsigned long, compound_nr(head),
+				  (unsigned long)MAX_ORDER_NR_PAGES))) {
 		/*
 		 * Corrupt page, so we cannot call page_mapping. Instead, do a
 		 * safe subset of the steps that page_mapping() does. Caution:
@@ -109,6 +111,8 @@  void __dump_page(struct page *page, const char *reason)
 					head, compound_order(head),
 					head_compound_mapcount(head));
 		}
+		if (compound_order(head) == HPAGE_PUD_ORDER && PMDPageInPUD(page))
+			pr_warn("sub_compound_mapcount:%d\n", sub_compound_mapcount(page));
 	}
 	if (PageKsm(page))
 		type = "ksm ";