Re: [PATCH] mm: Improve PageAnon() to check the whole PAGE_MAPPING_FLAGS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2019-11-15 at 11:18 Li Xinhai wrote:
>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@xxxxxxxxxx/
>
>Reported-by: Ralph Campbell <rcampbell@xxxxxxxxxx>
>Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
>Cc: Michal Hocko <mhocko@xxxxxxxx>
>Signed-off-by: Li Xinhai <lixinhai.lxh@xxxxxxxxx>
>---
> 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
> 

The current semantics of PageAnon() for both KSM and !KSM are used in many 
places, so can't change it alone without change other code.
Need skip this patch.

- Xinhai




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux