]> Git Repo - linux.git/commitdiff
mm/debug.c: always print flags in dump_page()
authorVlastimil Babka <[email protected]>
Fri, 31 Jan 2020 06:12:03 +0000 (22:12 -0800)
committerLinus Torvalds <[email protected]>
Fri, 31 Jan 2020 18:30:36 +0000 (10:30 -0800)
Commit 76a1850e4572 ("mm/debug.c: __dump_page() prints an extra line")
inadvertently removed printing of page flags for pages that are neither
anon nor ksm nor have a mapping.  Fix that.

Using pr_cont() again would be a solution, but the commit explicitly
removed its use.  Avoiding the danger of mixing up split lines from
multiple CPUs might be beneficial for near-panic dumps like this, so fix
this without reintroducing pr_cont().

Link: http://lkml.kernel.org/r/[email protected]
Fixes: 76a1850e4572 ("mm/debug.c: __dump_page() prints an extra line")
Signed-off-by: Vlastimil Babka <[email protected]>
Reported-by: Anshuman Khandual <[email protected]>
Reported-by: Michal Hocko <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Qian Cai <[email protected]>
Cc: Oscar Salvador <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: Mike Rapoport <[email protected]>
Cc: Dan Williams <[email protected]>
Cc: Pavel Tatashin <[email protected]>
Cc: Ralph Campbell <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/debug.c

index 74ee73cf7079a5431031d55feabfc43d4f01aa9b..4a9ded0d3504c4ad89abe701b01d6fd208c1f798 100644 (file)
@@ -47,6 +47,7 @@ void __dump_page(struct page *page, const char *reason)
        struct address_space *mapping;
        bool page_poisoned = PagePoisoned(page);
        int mapcount;
+       char *type = "";
 
        /*
         * If struct page is poisoned don't access Page*() functions as that
@@ -78,9 +79,9 @@ void __dump_page(struct page *page, const char *reason)
                        page, page_ref_count(page), mapcount,
                        page->mapping, page_to_pgoff(page));
        if (PageKsm(page))
-               pr_warn("ksm flags: %#lx(%pGp)\n", page->flags, &page->flags);
+               type = "ksm ";
        else if (PageAnon(page))
-               pr_warn("anon flags: %#lx(%pGp)\n", page->flags, &page->flags);
+               type = "anon ";
        else if (mapping) {
                if (mapping->host && mapping->host->i_dentry.first) {
                        struct dentry *dentry;
@@ -88,10 +89,11 @@ void __dump_page(struct page *page, const char *reason)
                        pr_warn("%ps name:\"%pd\"\n", mapping->a_ops, dentry);
                } else
                        pr_warn("%ps\n", mapping->a_ops);
-               pr_warn("flags: %#lx(%pGp)\n", page->flags, &page->flags);
        }
        BUILD_BUG_ON(ARRAY_SIZE(pageflag_names) != __NR_PAGEFLAGS + 1);
 
+       pr_warn("%sflags: %#lx(%pGp)\n", type, page->flags, &page->flags);
+
 hex_only:
        print_hex_dump(KERN_WARNING, "raw: ", DUMP_PREFIX_NONE, 32,
                        sizeof(unsigned long), page,
This page took 0.057526 seconds and 4 git commands to generate.