linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: Improve PageAnon() to check the whole PAGE_MAPPING_FLAGS
@ 2019-11-15  3:18 Li Xinhai
  2019-11-15  5:59 ` lixinhai.lxh
  0 siblings, 1 reply; 6+ messages in thread
From: Li Xinhai @ 2019-11-15  3:18 UTC (permalink / raw)
  To: linux-mm; +Cc: Andrew Morton, Michal Hocko

PageAnon() just checking on PAGE_MAPPING_ANON bit would cause page,
with PageKsm as true, been wrongly considered as PageAnon. Now,
checking the whole PAGE_MAPPING_FLAGS to avoid this error.

Reported from:
https://lore.kernel.org/linux-mm/20191113000651.20677-1-rcampbell@nvidia.com/

Reported-by: Ralph Campbell <rcampbell@nvidia.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Michal Hocko <mhocko@suse.com>
Signed-off-by: Li Xinhai <lixinhai.lxh@gmail.com>
---
 include/linux/page-flags.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 1bf83c8..1849fc3 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -461,7 +461,8 @@ static __always_inline int PageMappingFlags(struct page *page)
 static __always_inline int PageAnon(struct page *page)
 {
 	page = compound_head(page);
-	return ((unsigned long)page->mapping & PAGE_MAPPING_ANON) != 0;
+	return ((unsigned long)page->mapping & PAGE_MAPPING_FLAGS) == 
+				PAGE_MAPPING_ANON;
 }
 
 static __always_inline int __PageMovable(struct page *page)
-- 
1.8.3.1



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-11-15 15:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-15  3:18 [PATCH] mm: Improve PageAnon() to check the whole PAGE_MAPPING_FLAGS Li Xinhai
2019-11-15  5:59 ` lixinhai.lxh
2019-11-15 12:50   ` David Hildenbrand
2019-11-15 13:09     ` lixinhai.lxh
2019-11-15 13:25       ` Michal Hocko
2019-11-15 15:01         ` lixinhai.lxh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox