Skip to content

Commit 76a1850

Browse files
Ralph Campbelltorvalds
authored andcommitted
mm/debug.c: __dump_page() prints an extra line
When dumping struct page information, __dump_page() prints the page type with a trailing blank followed by the page flags on a separate line: anon flags: 0x100000000090034(uptodate|lru|active|head|swapbacked) It looks like the intent was to use pr_cont() for printing "flags:" but pr_cont() usage is discouraged so fix this by extending the format to include the flags into a single line: anon flags: 0x100000000090034(uptodate|lru|active|head|swapbacked) If the page is file backed, the name might be long so use two lines: shmem_aops name:"dev/zero" flags: 0x10000000008000c(uptodate|dirty|swapbacked) Eliminate pr_conf() usage as well for appending compound_mapcount. Link: http://lkml.kernel.org/r/20191112012608.16926-1-rcampbell@nvidia.com Signed-off-by: Ralph Campbell <rcampbell@nvidia.com> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Cc: Jerome Glisse <jglisse@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 5df373e commit 76a1850

1 file changed

Lines changed: 15 additions & 12 deletions

File tree

‎mm/debug.c‎

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,28 +67,31 @@ void __dump_page(struct page *page, const char *reason)
6767
*/
6868
mapcount = PageSlab(page) ? 0 : page_mapcount(page);
6969

70-
pr_warn("page:%px refcount:%d mapcount:%d mapping:%px index:%#lx",
71-
page, page_ref_count(page), mapcount,
72-
page->mapping, page_to_pgoff(page));
7370
if (PageCompound(page))
74-
pr_cont(" compound_mapcount: %d", compound_mapcount(page));
75-
pr_cont("\n");
71+
pr_warn("page:%px refcount:%d mapcount:%d mapping:%px "
72+
"index:%#lx compound_mapcount: %d\n",
73+
page, page_ref_count(page), mapcount,
74+
page->mapping, page_to_pgoff(page),
75+
compound_mapcount(page));
76+
else
77+
pr_warn("page:%px refcount:%d mapcount:%d mapping:%px index:%#lx\n",
78+
page, page_ref_count(page), mapcount,
79+
page->mapping, page_to_pgoff(page));
7680
if (PageAnon(page))
77-
pr_warn("anon ");
81+
pr_warn("anon flags: %#lx(%pGp)\n", page->flags, &page->flags);
7882
else if (PageKsm(page))
79-
pr_warn("ksm ");
83+
pr_warn("ksm flags: %#lx(%pGp)\n", page->flags, &page->flags);
8084
else if (mapping) {
81-
pr_warn("%ps ", mapping->a_ops);
8285
if (mapping->host && mapping->host->i_dentry.first) {
8386
struct dentry *dentry;
8487
dentry = container_of(mapping->host->i_dentry.first, struct dentry, d_u.d_alias);
85-
pr_warn("name:\"%pd\" ", dentry);
86-
}
88+
pr_warn("%ps name:\"%pd\"\n", mapping->a_ops, dentry);
89+
} else
90+
pr_warn("%ps\n", mapping->a_ops);
91+
pr_warn("flags: %#lx(%pGp)\n", page->flags, &page->flags);
8792
}
8893
BUILD_BUG_ON(ARRAY_SIZE(pageflag_names) != __NR_PAGEFLAGS + 1);
8994

90-
pr_warn("flags: %#lx(%pGp)\n", page->flags, &page->flags);
91-
9295
hex_only:
9396
print_hex_dump(KERN_WARNING, "raw: ", DUMP_PREFIX_NONE, 32,
9497
sizeof(unsigned long), page,

0 commit comments

Comments
 (0)