History

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.

Ralph Campbell committed 7 years ago

Commit 76a18501 parent 5df373e1 file · +15 −12Browse files

Unified · Split

mm/debug.c+15−12
@@ -67,28 +67,31 @@ void __dump_page(struct page *page, const char *reason) · 66 unmodified lines
67 */67 */
68 mapcount = PageSlab(page) ? 0 : page_mapcount(page);68 mapcount = PageSlab(page) ? 0 : page_mapcount(page);
69 69
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));
73 if (PageCompound(page))70 if (PageCompound(page))
74 pr_cont(" compound_mapcount: %d", compound_mapcount(page));71 pr_warn("page:%px refcount:%d mapcount:%d mapping:%px "
75 pr_cont("\n");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));
76 if (PageAnon(page))80 if (PageAnon(page))
77 pr_warn("anon ");81 pr_warn("anon flags: %#lx(%pGp)\n", page->flags, &page->flags);
78 else if (PageKsm(page))82 else if (PageKsm(page))
79 pr_warn("ksm ");83 pr_warn("ksm flags: %#lx(%pGp)\n", page->flags, &page->flags);
80 else if (mapping) {84 else if (mapping) {
81 pr_warn("%ps ", mapping->a_ops);
82 if (mapping->host && mapping->host->i_dentry.first) {85 if (mapping->host && mapping->host->i_dentry.first) {
83 struct dentry *dentry;86 struct dentry *dentry;
84 dentry = container_of(mapping->host->i_dentry.first, struct dentry, d_u.d_alias);87 dentry = container_of(mapping->host->i_dentry.first, struct dentry, d_u.d_alias);
85 pr_warn("name:\"%pd\" ", dentry);88 pr_warn("%ps name:\"%pd\"\n", mapping->a_ops, dentry);
86 }89 } else
90 pr_warn("%ps\n", mapping->a_ops);
91 pr_warn("flags: %#lx(%pGp)\n", page->flags, &page->flags);
87 }92 }
88 BUILD_BUG_ON(ARRAY_SIZE(pageflag_names) != __NR_PAGEFLAGS + 1);93 BUILD_BUG_ON(ARRAY_SIZE(pageflag_names) != __NR_PAGEFLAGS + 1);
89 94
90 pr_warn("flags: %#lx(%pGp)\n", page->flags, &page->flags);
91
92hex_only:95hex_only:
93 print_hex_dump(KERN_WARNING, "raw: ", DUMP_PREFIX_NONE, 32,96 print_hex_dump(KERN_WARNING, "raw: ", DUMP_PREFIX_NONE, 32,
94 sizeof(unsigned long), page,97 sizeof(unsigned long), page,