From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, Johannes Weiner <hannes@saeurebad.de>
Subject: Re: mm-more-likely-reclaim-madv_sequential-mappings.patch
Date: Fri, 17 Oct 2008 00:43:26 +1100 [thread overview]
Message-ID: <200810170043.26922.nickpiggin@yahoo.com.au> (raw)
In-Reply-To: <20081015162232.f673fa59.akpm@linux-foundation.org>
On Thursday 16 October 2008 10:22, Andrew Morton wrote:
> I have a note here that this patch needs better justification. But the
> changelog looks good and there are pretty graphs, so maybe my note is
> stale.
I think I was hoping for our VM to generically not be quite so stupid about
use-once access patterns and not behave so badly without this. But easier
said than done, and now I see the graphs show this is a fairly reasonable
change. One thing...
>
> Can people please check it?
>
> Thanks.
>
>
>
>
> From: Johannes Weiner <hannes@saeurebad.de>
>
> File pages accessed only once through sequential-read mappings between
> fault and scan time are perfect candidates for reclaim.
>
> This patch makes page_referenced() ignore these singular references and
> the pages stay on the inactive list where they likely fall victim to the
> next reclaim phase.
>
> Already activated pages are still treated normally. If they were accessed
> multiple times and therefor promoted to the active list, we probably want
> to keep them.
>
> Benchmarks show that big (relative to the system's memory) MADV_SEQUENTIAL
> mappings read sequentially cause much less kernel activity. Especially
> less LRU moving-around because we never activate read-once pages in the
> first place just to demote them again.
>
> And leaving these perfect reclaim candidates on the inactive list makes
> it more likely for the real working set to survive the next reclaim
> scan.
>
> Benchmark graphs and the test-application can be found here:
>
> http://hannes.saeurebad.de/madvseq/
>
> Signed-off-by: Johannes Weiner <hannes@saeurebad.de>
> Signed-off-by: Rik van Riel <riel@redhat.com>
> Cc: "KOSAKI Motohiro" <kosaki.motohiro@jp.fujitsu.com>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
>
> mm/rmap.c | 20 +++++++++++++++-----
> 1 file changed, 15 insertions(+), 5 deletions(-)
>
> diff -puN mm/rmap.c~mm-more-likely-reclaim-madv_sequential-mappings
> mm/rmap.c --- a/mm/rmap.c~mm-more-likely-reclaim-madv_sequential-mappings
> +++ a/mm/rmap.c
> @@ -327,8 +327,18 @@ static int page_referenced_one(struct pa
> goto out_unmap;
> }
>
> - if (ptep_clear_flush_young_notify(vma, address, pte))
> - referenced++;
> + if (ptep_clear_flush_young_notify(vma, address, pte)) {
> + /*
> + * If there was just one sequential access to the
> + * page, ignore it. Otherwise, mark_page_accessed()
> + * will have promoted the page to the active list and
> + * it should be kept.
> + */
> + if (VM_SequentialReadHint(vma) && !PageActive(page))
> + ClearPageReferenced(page);
> + else
> + referenced++;
> + }
ClearPageReferenced I don't know if it should be cleared like this.
PageReferenced is more of a bit for the mark_page_accessed state machine,
rather than the pte_young stuff. Although when unmapping, the latter
somewhat collapses back to the former, but I don't know if there is a
very good reason to fiddle with it here.
Ignoring the young bit in the pte for sequential hint maybe is OK (and
seems to be effective as per the benchmarks). But I would prefer not to
merge the PageReferenced parts unless they get their own justification.
So I'm happy with the ignoring pte_young part of the patch.
BTW. it seems like zap_pte_range should do a mark_page_accessed(), because
setting PG_accessed alone is quite a weak hint to reclaim... I don't think
it makes sense for mmap(), touch, munmap() access to arbitrarily be worth
less than a read(2).
I guess I should test and submit the patch...
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2008-10-16 13:43 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-15 23:22 mm-more-likely-reclaim-madv_sequential-mappings.patch Andrew Morton
2008-10-16 1:30 ` mm-more-likely-reclaim-madv_sequential-mappings.patch KOSAKI Motohiro
2008-10-16 6:01 ` mm-more-likely-reclaim-madv_sequential-mappings.patch KOSAKI Motohiro
2008-10-16 6:06 ` mm-more-likely-reclaim-madv_sequential-mappings.patch Andrew Morton
2008-10-16 6:22 ` mm-more-likely-reclaim-madv_sequential-mappings.patch KOSAKI Motohiro
2008-10-16 6:31 ` mm-more-likely-reclaim-madv_sequential-mappings.patch Andrew Morton
2008-10-16 6:38 ` mm-more-likely-reclaim-madv_sequential-mappings.patch KOSAKI Motohiro
2008-10-16 8:07 ` mm-more-likely-reclaim-madv_sequential-mappings.patch KOSAKI Motohiro
2008-10-16 6:09 ` mm-more-likely-reclaim-madv_sequential-mappings.patch KOSAKI Motohiro
2008-10-16 13:43 ` Nick Piggin [this message]
2008-10-16 17:04 ` mm-more-likely-reclaim-madv_sequential-mappings.patch Rik van Riel
2008-10-17 2:21 ` mm-more-likely-reclaim-madv_sequential-mappings.patch Nick Piggin
2008-10-17 5:37 ` mm-more-likely-reclaim-madv_sequential-mappings.patch KOSAKI Motohiro
2008-10-17 5:56 ` mm-more-likely-reclaim-madv_sequential-mappings.patch Nick Piggin
2008-10-17 16:51 ` mm-more-likely-reclaim-madv_sequential-mappings.patch Johannes Weiner
2008-10-18 1:30 ` mm-more-likely-reclaim-madv_sequential-mappings.patch Nick Piggin
2008-10-18 10:45 ` mm-more-likely-reclaim-madv_sequential-mappings.patch Johannes Weiner
2008-10-19 2:21 ` mm-more-likely-reclaim-madv_sequential-mappings.patch Nick Piggin
2008-10-19 2:43 ` mm-more-likely-reclaim-madv_sequential-mappings.patch Rik van Riel
2008-10-19 2:58 ` mm-more-likely-reclaim-madv_sequential-mappings.patch Nick Piggin
2008-10-19 14:39 ` mm-more-likely-reclaim-madv_sequential-mappings.patch Johannes Weiner
2008-10-21 1:45 ` mm-more-likely-reclaim-madv_sequential-mappings.patch Nick Piggin
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=200810170043.26922.nickpiggin@yahoo.com.au \
--to=nickpiggin@yahoo.com.au \
--cc=akpm@linux-foundation.org \
--cc=hannes@saeurebad.de \
--cc=linux-mm@kvack.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