linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: "Yin, Fengwei" <fengwei.yin@intel.com>
To: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: <willy@infradead.org>, <david@redhat.com>, <linux-mm@kvack.org>,
	<dave.hansen@intel.com>, <tim.c.chen@intel.com>,
	<ying.huang@intel.com>
Subject: Re: [RFC PATCH v2 1/5] mm: Enable fault around for shared file page fault
Date: Thu, 2 Feb 2023 09:54:58 +0800	[thread overview]
Message-ID: <b001e7ed-07fe-9280-dab0-6caefd1f9a19@intel.com> (raw)
In-Reply-To: <20230201143440.5mgy3x76wb32x3tr@box.shutemov.name>



On 2/1/2023 10:34 PM, Kirill A. Shutemov wrote:
> On Wed, Feb 01, 2023 at 04:17:33PM +0800, Yin Fengwei wrote:
>> The shared fault handler can also benefit from fault-around.  While it
>> is uncommon to write to MAP_SHARED files, applications that do will see
>> a huge benefit with will-it-scale:page_fault3 (shared file write fault)
>> improving by 375%.
>>
>> Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
>> Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
>> ---
>>  mm/memory.c | 11 +++++++++++
>>  1 file changed, 11 insertions(+)
>>
>> diff --git a/mm/memory.c b/mm/memory.c
>> index 7a04a1130ec1..51c04bb60724 100644
>> --- a/mm/memory.c
>> +++ b/mm/memory.c
>> @@ -4546,6 +4546,17 @@ static vm_fault_t do_shared_fault(struct vm_fault *vmf)
>>  	struct vm_area_struct *vma = vmf->vma;
>>  	vm_fault_t ret, tmp;
>>  
>> +	/*
>> +	 * Let's call ->map_pages() first and use ->fault() as fallback
>> +	 * if page by the offset is not ready to be mapped (cold cache or
>> +	 * something).
>> +	 */
>> +	if (should_fault_around(vmf)) {
>> +		ret = do_fault_around(vmf);
>> +		if (ret)
>> +			return ret;
>> +	}
>> +
> 
> I believe it bypasses ->page_mkwrite() completely, no?
> 
> So you get a writable PTEs without notifying the filesystem. Smells like a
> data loss.
Yes. You are right. This may be the reason why fault around is not enabled
for shared file write fault? I will drop this patch. Thanks.

Regards
Yin, Fengwei

> 
>>  	ret = __do_fault(vmf);
>>  	if (unlikely(ret & (VM_FAULT_ERROR | VM_FAULT_NOPAGE | VM_FAULT_RETRY)))
>>  		return ret;
>> -- 
>> 2.30.2
>>
>>
> 


  reply	other threads:[~2023-02-02  1:55 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-01  8:17 [RFC PATCH v2 0/5] folio based filemap_map_pages() Yin Fengwei
2023-02-01  8:17 ` [RFC PATCH v2 1/5] mm: Enable fault around for shared file page fault Yin Fengwei
2023-02-01 14:34   ` Kirill A. Shutemov
2023-02-02  1:54     ` Yin, Fengwei [this message]
2023-02-01  8:17 ` [RFC PATCH v2 2/5] filemap: add function filemap_map_folio_range() Yin Fengwei
2023-02-01  8:17 ` [RFC PATCH v2 3/5] rmap: add page_add_file_rmap_range() Yin Fengwei
2023-02-01 17:32   ` Matthew Wilcox
2023-02-02  2:00     ` Yin, Fengwei
2023-02-01  8:17 ` [RFC PATCH v2 4/5] mm: add do_set_pte_range() Yin Fengwei
2023-02-01  9:09   ` David Hildenbrand
2023-02-01 10:04     ` Yin, Fengwei
2023-02-01 17:38   ` Matthew Wilcox
2023-02-01 21:59     ` Matthew Wilcox
2023-02-02  3:18     ` Yin, Fengwei
2023-02-03  8:54     ` Yin Fengwei
2023-02-01  8:17 ` [RFC PATCH v2 5/5] filemap: batched update mm counter,rmap when map file folio Yin Fengwei
2023-02-01 15:50   ` Matthew Wilcox
2023-02-02  3:31     ` Yin, Fengwei
2023-02-03 13:15     ` Yin, Fengwei

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=b001e7ed-07fe-9280-dab0-6caefd1f9a19@intel.com \
    --to=fengwei.yin@intel.com \
    --cc=dave.hansen@intel.com \
    --cc=david@redhat.com \
    --cc=kirill@shutemov.name \
    --cc=linux-mm@kvack.org \
    --cc=tim.c.chen@intel.com \
    --cc=willy@infradead.org \
    --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