From: "Yajun Deng" <yajun.deng@linux.dev>
To: "Matthew Wilcox" <willy@infradead.org>
Cc: akpm@linux-foundation.org, david@redhat.com, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: unified folio_test_anon()/folio_anon_vma() and use them
Date: Fri, 12 Jul 2024 02:29:50 +0000 [thread overview]
Message-ID: <66e43c92d3b4ecfff50e84bdaeedfad3aa477df6@linux.dev> (raw)
In-Reply-To: <Zo_ZULOseAmEQMIw@casper.infradead.org>
July 11, 2024 at 9:08 PM, "Matthew Wilcox" <willy@infradead.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;
}
next prev parent reply other threads:[~2024-07-12 2:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-11 13:03 [PATCH] mm: unified folio_test_anon()/folio_anon_vma() and use them Yajun Deng
2024-07-11 13:08 ` Matthew Wilcox
2024-07-12 2:29 ` Yajun Deng [this message]
2024-07-12 2:59 ` Matthew Wilcox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=66e43c92d3b4ecfff50e84bdaeedfad3aa477df6@linux.dev \
--to=yajun.deng@linux.dev \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.