From: Zi Yan <z...@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 <z...@nvidia.com>
---
 mm/debug.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

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 ";
-- 
2.28.0

Reply via email to