Skip to content

Commit 6855ac4

Browse files
Ralph Campbelltorvalds
authored andcommitted
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: 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]>
1 parent 76a1850 commit 6855ac4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mm/debug.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ void __dump_page(struct page *page, const char *reason)
7777
pr_warn("page:%px refcount:%d mapcount:%d mapping:%px index:%#lx\n",
7878
page, page_ref_count(page), mapcount,
7979
page->mapping, page_to_pgoff(page));
80-
if (PageAnon(page))
81-
pr_warn("anon flags: %#lx(%pGp)\n", page->flags, &page->flags);
82-
else if (PageKsm(page))
80+
if (PageKsm(page))
8381
pr_warn("ksm flags: %#lx(%pGp)\n", page->flags, &page->flags);
82+
else if (PageAnon(page))
83+
pr_warn("anon flags: %#lx(%pGp)\n", page->flags, &page->flags);
8484
else if (mapping) {
8585
if (mapping->host && mapping->host->i_dentry.first) {
8686
struct dentry *dentry;

0 commit comments

Comments
 (0)