Commit be7c701f authored by Matthew Wilcox (Oracle)'s avatar Matthew Wilcox (Oracle) Committed by Linus Torvalds

mm/debug: factor PagePoisoned out of __dump_page

Move the PagePoisoned test into dump_page().  Skip the hex print for
poisoned pages -- we know they're full of ffffffff.  Move the reason
printing from __dump_page() to dump_page().

Link: https://lkml.kernel.org/r/20210416231531.2521383-3-willy@infradead.orgSigned-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: default avatarVlastimil Babka <vbabka@suse.cz>
Reviewed-by: default avatarAnshuman Khandual <anshuman.khandual@arm.com>
Reviewed-by: default avatarWilliam Kucharski <william.kucharski@oracle.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 691d9497
...@@ -42,11 +42,10 @@ const struct trace_print_flags vmaflag_names[] = { ...@@ -42,11 +42,10 @@ const struct trace_print_flags vmaflag_names[] = {
{0, NULL} {0, NULL}
}; };
static void __dump_page(struct page *page, const char *reason) static void __dump_page(struct page *page)
{ {
struct page *head = compound_head(page); struct page *head = compound_head(page);
struct address_space *mapping; struct address_space *mapping;
bool page_poisoned = PagePoisoned(page);
bool compound = PageCompound(page); bool compound = PageCompound(page);
/* /*
* Accessing the pageblock without the zone lock. It could change to * Accessing the pageblock without the zone lock. It could change to
...@@ -58,16 +57,6 @@ static void __dump_page(struct page *page, const char *reason) ...@@ -58,16 +57,6 @@ static void __dump_page(struct page *page, const char *reason)
int mapcount; int mapcount;
char *type = ""; char *type = "";
/*
* If struct page is poisoned don't access Page*() functions as that
* leads to recursive loop. Page*() check for poisoned pages, and calls
* dump_page() when detected.
*/
if (page_poisoned) {
pr_warn("page:%px is uninitialized and poisoned", page);
goto hex_only;
}
if (page < head || (page >= head + MAX_ORDER_NR_PAGES)) { if (page < head || (page >= head + MAX_ORDER_NR_PAGES)) {
/* /*
* Corrupt page, so we cannot call page_mapping. Instead, do a * Corrupt page, so we cannot call page_mapping. Instead, do a
...@@ -173,8 +162,6 @@ static void __dump_page(struct page *page, const char *reason) ...@@ -173,8 +162,6 @@ static void __dump_page(struct page *page, const char *reason)
pr_warn("%sflags: %#lx(%pGp)%s\n", type, head->flags, &head->flags, pr_warn("%sflags: %#lx(%pGp)%s\n", type, head->flags, &head->flags,
page_cma ? " CMA" : ""); page_cma ? " CMA" : "");
hex_only:
print_hex_dump(KERN_WARNING, "raw: ", DUMP_PREFIX_NONE, 32, print_hex_dump(KERN_WARNING, "raw: ", DUMP_PREFIX_NONE, 32,
sizeof(unsigned long), page, sizeof(unsigned long), page,
sizeof(struct page), false); sizeof(struct page), false);
...@@ -182,14 +169,16 @@ static void __dump_page(struct page *page, const char *reason) ...@@ -182,14 +169,16 @@ static void __dump_page(struct page *page, const char *reason)
print_hex_dump(KERN_WARNING, "head: ", DUMP_PREFIX_NONE, 32, print_hex_dump(KERN_WARNING, "head: ", DUMP_PREFIX_NONE, 32,
sizeof(unsigned long), head, sizeof(unsigned long), head,
sizeof(struct page), false); sizeof(struct page), false);
if (reason)
pr_warn("page dumped because: %s\n", reason);
} }
void dump_page(struct page *page, const char *reason) void dump_page(struct page *page, const char *reason)
{ {
__dump_page(page, reason); if (PagePoisoned(page))
pr_warn("page:%p is uninitialized and poisoned", page);
else
__dump_page(page);
if (reason)
pr_warn("page dumped because: %s\n", reason);
dump_page_owner(page); dump_page_owner(page);
} }
EXPORT_SYMBOL(dump_page); EXPORT_SYMBOL(dump_page);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment