From: Minchan Kim <minchan@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
Michal Hocko <mhocko@suse.cz>,
Johannes Weiner <hannes@cmpxchg.org>,
Mel Gorman <mgorman@suse.de>, Rik van Riel <riel@redhat.com>,
Shaohua Li <shli@kernel.org>,
Yalin.Wang@sonymobile.com
Subject: Re: [PATCH 3/4] mm: move lazy free pages to inactive list
Date: Mon, 30 Mar 2015 14:35:02 +0900 [thread overview]
Message-ID: <20150330053502.GB3008@blaptop> (raw)
In-Reply-To: <20150320154358.51bcf3cbceeb8fbbdb2b58e5@linux-foundation.org>
Hello Andrew,
On Fri, Mar 20, 2015 at 03:43:58PM -0700, Andrew Morton wrote:
> On Wed, 11 Mar 2015 10:20:37 +0900 Minchan Kim <minchan@kernel.org> wrote:
>
> > MADV_FREE is hint that it's okay to discard pages if there is
> > memory pressure and we uses reclaimers(ie, kswapd and direct reclaim)
> > to free them so there is no worth to remain them in active anonymous LRU
> > so this patch moves them to inactive LRU list's head.
> >
> > This means that MADV_FREE-ed pages which were living on the inactive list
> > are reclaimed first because they are more likely to be cold rather than
> > recently active pages.
> >
> > A arguable issue for the approach would be whether we should put it to
> > head or tail in inactive list. I selected *head* because kernel cannot
> > make sure it's really cold or warm for every MADV_FREE usecase but
> > at least we know it's not *hot* so landing of inactive head would be
> > comprimise for various usecases.
> >
> > This is fixing a suboptimal behavior of MADV_FREE when pages living on
> > the active list will sit there for a long time even under memory
> > pressure while the inactive list is reclaimed heavily. This basically
> > breaks the whole purpose of using MADV_FREE to help the system to free
> > memory which is might not be used.
> >
> > @@ -789,6 +790,23 @@ static void lru_deactivate_file_fn(struct page *page, struct lruvec *lruvec,
> > update_page_reclaim_stat(lruvec, file, 0);
> > }
> >
> > +
> > +static void lru_deactivate_fn(struct page *page, struct lruvec *lruvec,
> > + void *arg)
> >
> > ...
> >
> > @@ -844,6 +866,18 @@ void deactivate_file_page(struct page *page)
> > }
> > }
> >
> > +void deactivate_page(struct page *page)
> > +{
>
> lru_deactivate_file_fn() and deactivate_file_page() are carefully
> documented and lru_deactivate_fn() and deactivate_page() should
> be as well. In fact it becomes more important now that we have two
> similar-looking things.
Sorry, I have missed this comment.
Acutally, deactive_file_page was too specific on file-backed page
invalidation when I implemented first time. That's why it had a lot
description but deactivate_page is too general so I think short comment
is enough. :)
Here it goes.
Thanks.
next prev parent reply other threads:[~2015-03-30 5:35 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-11 1:20 [PATCH 1/4] mm: free swp_entry in madvise_free Minchan Kim
2015-03-11 1:20 ` [PATCH 2/4] mm: change deactivate_page with deactivate_file_page Minchan Kim
2015-03-11 1:20 ` [PATCH 3/4] mm: move lazy free pages to inactive list Minchan Kim
2015-03-11 2:14 ` Wang, Yalin
2015-03-11 4:30 ` Minchan Kim
2015-04-01 20:38 ` Rik van Riel
2015-03-11 9:05 ` [RFC ] mm: don't ignore file map pages for madvise_free( ) Wang, Yalin
2015-03-11 9:47 ` [RFC] mm:do recheck for freeable page in reclaim path Wang, Yalin
2015-03-20 22:43 ` [PATCH 3/4] mm: move lazy free pages to inactive list Andrew Morton
2015-03-30 5:35 ` Minchan Kim [this message]
2015-03-30 21:20 ` Andrew Morton
2015-03-31 4:45 ` Minchan Kim
2015-03-31 5:28 ` Andrew Morton
2015-03-31 5:57 ` Minchan Kim
2015-03-11 1:20 ` [PATCH 4/4] mm: make every pte dirty on do_swap_page Minchan Kim
2015-03-30 5:22 ` Minchan Kim
2015-03-30 8:51 ` Cyrill Gorcunov
2015-03-30 8:59 ` Minchan Kim
2015-03-30 21:14 ` Cyrill Gorcunov
2015-03-31 4:38 ` Minchan Kim
2015-04-08 23:50 ` Minchan Kim
2015-04-09 20:59 ` Andrew Morton
2015-04-10 0:08 ` Minchan Kim
2015-04-10 0:14 ` Rik van Riel
2015-04-11 21:40 ` Hugh Dickins
2015-04-12 14:48 ` Minchan Kim
2015-04-15 6:49 ` Minchan Kim
2015-03-19 0:46 ` [PATCH 1/4] mm: free swp_entry in madvise_free Minchan Kim
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=20150330053502.GB3008@blaptop \
--to=minchan@kernel.org \
--cc=Yalin.Wang@sonymobile.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=mhocko@suse.cz \
--cc=riel@redhat.com \
--cc=shli@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox