From: David Rientjes <rientjes@google.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Huang, Ying" <ying.huang@intel.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Dave Hansen <dave.hansen@linux.intel.com>,
David Hildenbrand <david@redhat.com>,
Mel Gorman <mgorman@suse.de>, Vlastimil Babka <vbabka@suse.cz>,
Zi Yan <ziy@nvidia.com>, Michal Hocko <mhocko@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Minchan Kim <minchan@kernel.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Hugh Dickins <hughd@google.com>
Subject: Re: [PATCH] mm: Add PageLayzyFree() helper functions for MADV_FREE
Date: Tue, 3 Mar 2020 17:27:05 -0800 (PST) [thread overview]
Message-ID: <alpine.DEB.2.21.2003031726300.77561@chino.kir.corp.google.com> (raw)
In-Reply-To: <20200303165859.7440f23d388503ca77fdb6c2@linux-foundation.org>
On Tue, 3 Mar 2020, Andrew Morton wrote:
> On Tue, 3 Mar 2020 11:37:38 +0800 "Huang, Ying" <ying.huang@intel.com> wrote:
>
> > From: Huang Ying <ying.huang@intel.com>
> >
> > Now PageSwapBacked() is used as the helper function to check whether
> > pages have been freed lazily via MADV_FREE. This isn't very obvious.
> > So Dave suggested to add PageLazyFree() family helper functions to
> > improve the code readability.
> >
> > --- a/include/linux/page-flags.h
> > +++ b/include/linux/page-flags.h
> > @@ -498,6 +498,31 @@ static __always_inline int PageKsm(struct page *page)
> > TESTPAGEFLAG_FALSE(Ksm)
> > #endif
> >
> > +/*
> > + * For pages freed lazily via MADV_FREE. lazyfree pages are clean
> > + * anonymous pages. They have SwapBacked flag cleared to distinguish
> > + * with normal anonymous pages
> > + */
> > +static __always_inline int PageLazyFree(struct page *page)
> > +{
> > + page = compound_head(page);
> > + return PageAnon(page) && !PageSwapBacked(page);
> > +}
> > +
> > +static __always_inline void SetPageLazyFree(struct page *page)
> > +{
> > + VM_BUG_ON_PAGE(PageTail(page), page);
> > + VM_BUG_ON_PAGE(!PageAnon(page), page);
> > + ClearPageSwapBacked(page);
> > +}
> > +
> > +static __always_inline void ClearPageLazyFree(struct page *page)
> > +{
> > + VM_BUG_ON_PAGE(PageTail(page), page);
> > + VM_BUG_ON_PAGE(!PageAnon(page), page);
> > + SetPageSwapBacked(page);
> > +}
>
> These BUG_ONs aren't present in the current code and are
> unchangelogged.
>
Yeah, as well as the implicit conversion to check compound_head().
prev parent reply other threads:[~2020-03-04 1:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-03 3:37 Huang, Ying
2020-03-04 0:58 ` Andrew Morton
2020-03-04 1:20 ` Huang, Ying
2020-03-04 1:27 ` David Rientjes [this message]
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=alpine.DEB.2.21.2003031726300.77561@chino.kir.corp.google.com \
--to=rientjes@google.com \
--cc=akpm@linux-foundation.org \
--cc=dave.hansen@linux.intel.com \
--cc=david@redhat.com \
--cc=hannes@cmpxchg.org \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=mhocko@kernel.org \
--cc=minchan@kernel.org \
--cc=peterz@infradead.org \
--cc=vbabka@suse.cz \
--cc=ying.huang@intel.com \
--cc=ziy@nvidia.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox