From: Johannes Weiner <hannes@cmpxchg.org>
To: Shaohua Li <shli@fb.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Kernel-team@fb.com, mhocko@suse.com, minchan@kernel.org,
hughd@google.com, riel@redhat.com, mgorman@techsingularity.net,
akpm@linux-foundation.org
Subject: Re: [PATCH V3 2/7] mm: move MADV_FREE pages into LRU_INACTIVE_FILE list
Date: Fri, 17 Feb 2017 11:22:02 -0500 [thread overview]
Message-ID: <20170217162202.GE23735@cmpxchg.org> (raw)
In-Reply-To: <20170217003524.GA95440@shli-mbp.local>
On Thu, Feb 16, 2017 at 04:35:25PM -0800, Shaohua Li wrote:
> On Thu, Feb 16, 2017 at 12:52:53PM -0500, Johannes Weiner wrote:
> > On Tue, Feb 14, 2017 at 11:36:08AM -0800, Shaohua Li wrote:
> > > @@ -126,4 +126,24 @@ static __always_inline enum lru_list page_lru(struct page *page)
> > >
> > > #define lru_to_page(head) (list_entry((head)->prev, struct page, lru))
> > >
> > > +/*
> > > + * lazyfree pages are clean anonymous pages. They have SwapBacked flag cleared
> > > + * to destinguish normal anonymous pages.
> > > + */
> > > +static inline void set_page_lazyfree(struct page *page)
> > > +{
> > > + VM_BUG_ON_PAGE(!PageAnon(page) || !PageSwapBacked(page), page);
> > > + ClearPageSwapBacked(page);
> > > +}
> > > +
> > > +static inline void clear_page_lazyfree(struct page *page)
> > > +{
> > > + VM_BUG_ON_PAGE(!PageAnon(page) || PageSwapBacked(page), page);
> > > + SetPageSwapBacked(page);
> > > +}
> > > +
> > > +static inline bool page_is_lazyfree(struct page *page)
> > > +{
> > > + return PageAnon(page) && !PageSwapBacked(page);
> > > +}
> >
> > Sorry for not getting to v2 in time, but I have to say I strongly
> > agree with your first iterations and would much prefer this to be
> > open-coded.
> >
> > IMO this needlessly introduces a new state opaquely called "lazyfree",
> > when really that's just anonymous pages that don't need to be swapped
> > before reclaim - PageAnon && !PageSwapBacked. Very simple MM concept.
> >
> > That especially shows when we later combine it with page_is_file_cache
> > checks like the next patch does.
> >
> > The rest of the patch looks good to me.
>
> Thanks! I do agree checking PageSwapBacked is clearer, but Minchan convinced me
> because of the accounting issue. Where do you suggest we should put the
> accounting to?
I now proposed quite a few changes to the setting and clearing sites,
so it's harder to judge, but AFAICT once those sites are consolidated,
open-coding the stat updates as well shouldn't be too bad, right?
One site to clear during MADV_FREE, one site to set during reclaim.
next prev parent reply other threads:[~2017-02-17 16:22 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-14 19:36 [PATCH V3 0/7] mm: fix some MADV_FREE issues Shaohua Li
2017-02-14 19:36 ` [PATCH V3 1/7] mm: don't assume anonymous pages have SwapBacked flag Shaohua Li
2017-02-16 17:39 ` Johannes Weiner
2017-02-14 19:36 ` [PATCH V3 2/7] mm: move MADV_FREE pages into LRU_INACTIVE_FILE list Shaohua Li
2017-02-16 17:52 ` Johannes Weiner
2017-02-17 0:35 ` Shaohua Li
2017-02-17 16:22 ` Johannes Weiner [this message]
2017-02-14 19:36 ` [PATCH V3 3/7] mm: reclaim MADV_FREE pages Shaohua Li
2017-02-16 18:40 ` Johannes Weiner
2017-02-17 0:27 ` Shaohua Li
2017-02-17 5:45 ` Minchan Kim
2017-02-17 16:11 ` Johannes Weiner
2017-02-17 16:01 ` Johannes Weiner
2017-02-17 18:43 ` Shaohua Li
2017-02-17 20:03 ` Johannes Weiner
2017-02-17 5:41 ` Minchan Kim
2017-02-17 9:27 ` Minchan Kim
2017-02-17 16:15 ` Johannes Weiner
2017-02-14 19:36 ` [PATCH V3 4/7] mm: enable MADV_FREE for swapless system Shaohua Li
2017-02-17 16:16 ` Johannes Weiner
2017-02-14 19:36 ` [PATCH V3 5/7] mm: add vmstat account for MADV_FREE pages Shaohua Li
2017-02-14 19:36 ` [PATCH V3 6/7] proc: show MADV_FREE pages info in smaps Shaohua Li
2017-02-14 19:36 ` [PATCH V3 7/7] mm: add a separate RSS for MADV_FREE pages Shaohua Li
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=20170217162202.GE23735@cmpxchg.org \
--to=hannes@cmpxchg.org \
--cc=Kernel-team@fb.com \
--cc=akpm@linux-foundation.org \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=mhocko@suse.com \
--cc=minchan@kernel.org \
--cc=riel@redhat.com \
--cc=shli@fb.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;
as well as URLs for NNTP newsgroup(s).