Skip to content

Commit e0392cf

Browse files
Michal Hockotorvalds
authored andcommitted
mm: lower the printk loglevel for __dump_page messages
__dump_page messages use KERN_EMERG resp. KERN_ALERT loglevel (this is the case since 2004). Most callers of this function are really detecting a critical page state and BUG right after. On the other hand the function is called also from contexts which just want to inform about the page state and those would rather not disrupt logs that much (e.g. some systems route these messages to the normal console). Reduce the loglevel to KERN_WARNING to make dump_page easier to reuse for other contexts while those messages will still make it to the kernel log in most setups. Even if the loglevel setup filters warnings away those paths that are really critical already print the more targeted error or panic and that should make it to the kernel log. [mhocko@kernel.org: fix __dump_page()] Link: http://lkml.kernel.org/r/20181212142540.GA7378@dhcp22.suse.cz [akpm@linux-foundation.org: s/KERN_WARN/KERN_WARNING/, per Michal] Link: http://lkml.kernel.org/r/20181107101830.17405-3-mhocko@kernel.org Signed-off-by: Michal Hocko <mhocko@suse.com> Reviewed-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com> Cc: Baoquan He <bhe@redhat.com> Cc: Oscar Salvador <OSalvador@suse.com> Cc: Oscar Salvador <osalvador@suse.de> Cc: William Kucharski <william.kucharski@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 1c6fb1d commit e0392cf

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

mm/debug.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ void __dump_page(struct page *page, const char *reason)
5454
* dump_page() when detected.
5555
*/
5656
if (page_poisoned) {
57-
pr_emerg("page:%px is uninitialized and poisoned", page);
57+
pr_warn("page:%px is uninitialized and poisoned", page);
5858
goto hex_only;
5959
}
6060

@@ -65,39 +65,39 @@ void __dump_page(struct page *page, const char *reason)
6565
*/
6666
mapcount = PageSlab(page) ? 0 : page_mapcount(page);
6767

68-
pr_emerg("page:%px count:%d mapcount:%d mapping:%px index:%#lx",
68+
pr_warn("page:%px count:%d mapcount:%d mapping:%px index:%#lx",
6969
page, page_ref_count(page), mapcount,
7070
page->mapping, page_to_pgoff(page));
7171
if (PageCompound(page))
7272
pr_cont(" compound_mapcount: %d", compound_mapcount(page));
7373
pr_cont("\n");
7474
if (PageAnon(page))
75-
pr_emerg("anon ");
75+
pr_warn("anon ");
7676
else if (PageKsm(page))
77-
pr_emerg("ksm ");
77+
pr_warn("ksm ");
7878
else if (mapping) {
79-
pr_emerg("%ps ", mapping->a_ops);
79+
pr_warn("%ps ", mapping->a_ops);
8080
if (mapping->host->i_dentry.first) {
8181
struct dentry *dentry;
8282
dentry = container_of(mapping->host->i_dentry.first, struct dentry, d_u.d_alias);
83-
pr_emerg("name:\"%pd\" ", dentry);
83+
pr_warn("name:\"%pd\" ", dentry);
8484
}
8585
}
8686
BUILD_BUG_ON(ARRAY_SIZE(pageflag_names) != __NR_PAGEFLAGS + 1);
8787

88-
pr_emerg("flags: %#lx(%pGp)\n", page->flags, &page->flags);
88+
pr_warn("flags: %#lx(%pGp)\n", page->flags, &page->flags);
8989

9090
hex_only:
91-
print_hex_dump(KERN_ALERT, "raw: ", DUMP_PREFIX_NONE, 32,
91+
print_hex_dump(KERN_WARNING, "raw: ", DUMP_PREFIX_NONE, 32,
9292
sizeof(unsigned long), page,
9393
sizeof(struct page), false);
9494

9595
if (reason)
96-
pr_alert("page dumped because: %s\n", reason);
96+
pr_warn("page dumped because: %s\n", reason);
9797

9898
#ifdef CONFIG_MEMCG
9999
if (!page_poisoned && page->mem_cgroup)
100-
pr_alert("page->mem_cgroup:%px\n", page->mem_cgroup);
100+
pr_warn("page->mem_cgroup:%px\n", page->mem_cgroup);
101101
#endif
102102
}
103103

0 commit comments

Comments
 (0)