[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <66e43c92d3b4ecfff50e84bdaeedfad3aa477df6@linux.dev>
Date: Fri, 12 Jul 2024 02:29:50 +0000
From: "Yajun Deng" <yajun.deng@...ux.dev>
To: "Matthew Wilcox" <willy@...radead.org>
Cc: akpm@...ux-foundation.org, david@...hat.com, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm: unified folio_test_anon()/folio_anon_vma() and use
them
July 11, 2024 at 9:08 PM, "Matthew Wilcox" <willy@...radead.org> wrote:
>
> On Thu, Jul 11, 2024 at 09:03:51PM +0800, Yajun Deng wrote:
>
> >
> > +++ b/include/linux/page-flags.h
> >
> > @@ -691,7 +691,8 @@ static __always_inline bool PageMappingFlags(const struct page *page)
> >
> >
> >
> > static __always_inline bool folio_test_anon(const struct folio *folio)
> >
> > {
> >
> > - return ((unsigned long)folio->mapping & PAGE_MAPPING_ANON) != 0;
> >
> > + return ((unsigned long)folio->mapping & PAGE_MAPPING_FLAGS) ==
> >
> > + PAGE_MAPPING_ANON;
> >
> > }
> >
>
> This is wrong. KSM pages are supposed to return true for
>
> folio_test_anon(). I haven't looked any further at this patch, since
>
> the premise appears to wrong and you clearly haven't tested.
>
Thank you for pointing this out. It was my mistake!
I think I need to add a new helper function, like __folio_test_movable. e.g.
static __always_inline bool __folio_test_anon(const struct folio *folio)
{
return ((unsigned long)folio->mapping & PAGE_MAPPING_FLAGS) ==
PAGE_MAPPING_ANON;
}
Powered by blists - more mailing lists