From: Vinayak Menon <vinmenon@codeaurora.org>
To: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: linux-mm@kvack.org, kirill.shutemov@linux.intel.com,
akpm@linux-foundation.org, minchan@kernel.org,
catalin.marinas@arm.com, will.deacon@arm.com,
ying.huang@intel.com, riel@redhat.com,
dave.hansen@linux.intel.com, mgorman@suse.de,
torvalds@linux-foundation.org, jack@suse.cz
Subject: Re: [PATCH v2] mm: make faultaround produce old ptes
Date: Mon, 22 Jan 2018 11:29:46 +0530 [thread overview]
Message-ID: <5519894f-d5fc-fc9c-e6b7-be783bd38a21@codeaurora.org> (raw)
In-Reply-To: <20180119142454.wa4gtkabrliyd6d6@node.shutemov.name>
On 1/19/2018 7:54 PM, Kirill A. Shutemov wrote:
> On Thu, Jan 18, 2018 at 06:26:50PM +0530, Vinayak Menon wrote:
>> Based on Kirill's patch [1].
>>
>> Currently, faultaround code produces young pte. This can screw up
>> vmscan behaviour[2], as it makes vmscan think that these pages are hot
>> and not push them out on first round.
>>
>> During sparse file access faultaround gets more pages mapped and all of
>> them are young. Under memory pressure, this makes vmscan swap out anon
>> pages instead, or to drop other page cache pages which otherwise stay
>> resident.
>>
>> Modify faultaround to produce old ptes if sysctl 'want_old_faultaround_pte'
>> is set, so they can easily be reclaimed under memory pressure.
>>
>> This can to some extend defeat the purpose of faultaround on machines
>> without hardware accessed bit as it will not help us with reducing the
>> number of minor page faults.
>>
>> Making the faultaround ptes old results in a unixbench regression for some
>> architectures [3][4]. But on some architectures like arm64 it is not found
>> to cause any regression.
>>
>> unixbench shell8 scores on arm64 v8.2 hardware with CONFIG_ARM64_HW_AFDBM
>> enabled (5 runs min, max, avg):
>> Base: (741,748,744)
>> With this patch: (739,748,743)
>>
>> So by default produce young ptes and provide a sysctl option to make the
>> ptes old.
>>
>> [1] http://lkml.kernel.org/r/1463488366-47723-1-git-send-email-kirill.shutemov@linux.intel.com
>> [2] https://lkml.kernel.org/r/1460992636-711-1-git-send-email-vinmenon@codeaurora.org
>> [3] https://marc.info/?l=linux-kernel&m=146582237922378&w=2
>> [4] https://marc.info/?l=linux-mm&m=146589376909424&w=2
>>
>> Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org>
>> ---
>>
>> V2:
>> 1. Removed the arch hook and want_old_faultaround_pte is made a sysctl
>> 2. Renamed FAULT_FLAG_MKOLD to FAULT_FLAG_PREFAULT_OLD (suggested by Jan Kara)
>> 3. Removed the saved fault address from vmf (suggested by Jan Kara)
>>
>> Documentation/sysctl/vm.txt | 22 ++++++++++++++++++++++
>> include/linux/mm.h | 3 +++
>> kernel/sysctl.c | 9 +++++++++
>> mm/filemap.c | 10 ++++++++++
>> mm/memory.c | 4 ++++
>> 5 files changed, 48 insertions(+)
>>
>> diff --git a/Documentation/sysctl/vm.txt b/Documentation/sysctl/vm.txt
>> index 17256f2..e015940 100644
>> --- a/Documentation/sysctl/vm.txt
>> +++ b/Documentation/sysctl/vm.txt
>> @@ -63,6 +63,7 @@ Currently, these files are in /proc/sys/vm:
>> - vfs_cache_pressure
>> - watermark_scale_factor
>> - zone_reclaim_mode
>> +- want_old_faultaround_pte
>>
>> ==============================================================
>>
>> @@ -887,4 +888,25 @@ Allowing regular swap effectively restricts allocations to the local
>> node unless explicitly overridden by memory policies or cpuset
>> configurations.
>>
>> +=============================================================
>> +
>> +want_old_faultaround_pte:
>> +
>> +By default faultaround code produces young pte. When want_old_faultaround_pte is
>> +set to 1, faultaround produces old ptes.
>> +
>> +During sparse file access faultaround gets more pages mapped and when all of
>> +them are young (default), under memory pressure, this makes vmscan swap out anon
>> +pages instead, or to drop other page cache pages which otherwise stay resident.
>> +Setting want_old_faultaround_pte to 1 avoids this.
>> +
>> +Making the faultaround ptes old can result in performance regression on some
>> +architectures. This is due to cycles spent in micro-fault for TLB lookup of old
>> +entry.
> It's not for TLB lookup. Micro-fault would take page walk to set young bit in
> the pte.
Fixed it in v3. Thanks Kirill.
--
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>
prev parent reply other threads:[~2018-01-22 5:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-18 12:56 [PATCH v2] mm: make faultaround produce old ptes Vinayak Menon
2018-01-19 14:24 ` Kirill A. Shutemov
2018-01-22 5:59 ` Vinayak Menon [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=5519894f-d5fc-fc9c-e6b7-be783bd38a21@codeaurora.org \
--to=vinmenon@codeaurora.org \
--cc=akpm@linux-foundation.org \
--cc=catalin.marinas@arm.com \
--cc=dave.hansen@linux.intel.com \
--cc=jack@suse.cz \
--cc=kirill.shutemov@linux.intel.com \
--cc=kirill@shutemov.name \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=minchan@kernel.org \
--cc=riel@redhat.com \
--cc=torvalds@linux-foundation.org \
--cc=will.deacon@arm.com \
--cc=ying.huang@intel.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).