linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [patch 11/11] mm/debug.c: PageAnon() is true for PageKsm() pages
@ 2019-11-16  1:35 akpm
  0 siblings, 0 replies; only message in thread
From: akpm @ 2019-11-16  1:35 UTC (permalink / raw)
  To: akpm, jglisse, linux-mm, mhocko, mm-commits, rcampbell, torvalds

From: Ralph Campbell <rcampbell@nvidia.com>
Subject: 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/20191113000651.20677-1-rcampbell@nvidia.com
Fixes: 1c6fb1d89e73 ("mm: print more information about mapping in __dump_page")
Signed-off-by: Ralph Campbell <rcampbell@nvidia.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 mm/debug.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/mm/debug.c~mm-debug-pageanon-is-true-for-pageksm-pages
+++ a/mm/debug.c
@@ -77,10 +77,10 @@ void __dump_page(struct page *page, cons
 		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;
_


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2019-11-16  1:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-16  1:35 [patch 11/11] mm/debug.c: PageAnon() is true for PageKsm() pages akpm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).