diff options
authorRalph Campbell <>2019-11-15 17:35:07 -0800
committerLinus Torvalds <>2019-11-15 18:34:00 -0800
commit6855ac4acd3bad4a5caf813b0e401a0bc79a54a9 (patch)
parent76a1850e45724e8aca44fc0a245de6782ce42e65 (diff)
mm/debug.c: PageAnon() is true for PageKsm() pages
PageAnon() and PageKsm() use the low two bits of the page->mapping pointer to indicate the page type. PageAnon() only checks the LSB while PageKsm() checks the least significant 2 bits are equal to 3. Therefore, PageAnon() is true for KSM pages. __dump_page() incorrectly will never print "ksm" because it checks PageAnon() first. Fix this by checking PageKsm() first. Link: Fixes: 1c6fb1d89e73 ("mm: print more information about mapping in __dump_page") Signed-off-by: Ralph Campbell <> Acked-by: Michal Hocko <> Cc: Jerome Glisse <> Signed-off-by: Andrew Morton <> Signed-off-by: Linus Torvalds <>
1 files changed, 3 insertions, 3 deletions
diff --git a/mm/debug.c b/mm/debug.c
index 772d4cf0691f..0461df1207cb 100644
--- a/mm/debug.c
+++ b/mm/debug.c
@@ -77,10 +77,10 @@ void __dump_page(struct page *page, const char *reason)
pr_warn("page:%px refcount:%d mapcount:%d mapping:%px index:%#lx\n",
page, page_ref_count(page), mapcount,
page->mapping, page_to_pgoff(page));
- if (PageAnon(page))
- pr_warn("anon flags: %#lx(%pGp)\n", page->flags, &page->flags);
- else if (PageKsm(page))
+ if (PageKsm(page))
pr_warn("ksm flags: %#lx(%pGp)\n", page->flags, &page->flags);
+ else if (PageAnon(page))
+ pr_warn("anon flags: %#lx(%pGp)\n", page->flags, &page->flags);
else if (mapping) {
if (mapping->host && mapping->host->i_dentry.first) {
struct dentry *dentry;