Skip to content

Commit

Permalink
mm/debug.c: PageAnon() is true for PageKsm() pages
Browse files Browse the repository at this point in the history
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: http://lkml.kernel.org/r/[email protected]
Fixes: 1c6fb1d ("mm: print more information about mapping in __dump_page")
Signed-off-by: Ralph Campbell <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Cc: Jerome Glisse <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Ralph Campbell authored and torvalds committed Nov 16, 2019
1 parent 76a1850 commit 6855ac4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mm/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6855ac4

Please sign in to comment.