If we can't call page_mapping() to get the page mapping, handle the anon/ksm/movable bits correctly. Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> --- mm/debug.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mm/debug.c b/mm/debug.c index 4f376514744d..e5de63406b59 100644 --- a/mm/debug.c +++ b/mm/debug.c @@ -70,7 +70,12 @@ void __dump_page(struct page *page, const char *reason) if (page < head || (page >= head + MAX_ORDER_NR_PAGES)) { /* Corrupt page, cannot call page_mapping */ - mapping = page->mapping; + unsigned long tmp = (unsigned long)page->mapping; + + if (tmp & PAGE_MAPPING_ANON) + mapping = NULL; + else + mapping = (void *)(tmp & ~PAGE_MAPPING_FLAGS); head = page; compound = false; } else { -- 2.27.0