From: Andy Lutomirski <luto@amacapital.net>
To: Matthew Wilcox <willy@linux.intel.com>
Cc: Matthew Wilcox <matthew.r.wilcox@intel.com>,
Ingo Molnar <mingo@redhat.com>, Kees Cook <keescook@chromium.org>,
Andrew Morton <akpm@linux-foundation.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: Re: [PATCH 3/3] dax: Handle write faults more efficiently
Date: Tue, 26 Jan 2016 22:01:08 -0800 [thread overview]
Message-ID: <CALCETrXdCWtsLxhx_DqNPEma4mo71iTXF-FTVzSOfD9HDaiqhg@mail.gmail.com> (raw)
In-Reply-To: <20160127041706.GP2948@linux.intel.com>
On Tue, Jan 26, 2016 at 8:17 PM, Matthew Wilcox <willy@linux.intel.com> wrote:
> On Mon, Jan 25, 2016 at 09:38:19AM -0800, Andy Lutomirski wrote:
>> On Mon, Jan 25, 2016 at 9:25 AM, Matthew Wilcox
>> <matthew.r.wilcox@intel.com> wrote:
>> > From: Matthew Wilcox <willy@linux.intel.com>
>> >
>> > When we handle a write-fault on a DAX mapping, we currently insert a
>> > read-only mapping and then take the page fault again to convert it to
>> > a writable mapping. This is necessary for the case where we cover a
>> > hole with a read-only zero page, but when we have a data block already
>> > allocated, it is inefficient.
>> >
>> > Use the recently added vmf_insert_pfn_prot() to insert a writable mapping,
>> > even though the default VM flags say to use a read-only mapping.
>>
>> Conceptually, I like this. Do you need to make sure to do all the
>> do_wp_page work, though? (E.g. we currently update mtime in there.
>> Some day I'll fix that, but it'll be replaced with a set_bit to force
>> a deferred mtime update.)
>
> We update mtime in the ->fault handler of filesystems which support DAX
> like this:
>
> if (vmf->flags & FAULT_FLAG_WRITE) {
> sb_start_pagefault(inode->i_sb);
> file_update_time(vma->vm_file);
> }
>
> so I think we're covered.
A question that came up on IRC: if the page is a reflinked page on XFS
(whenever that feature lands), then presumably XFS has real work to do
in page_mkwrite. If so, what ensures that page_mkwrite gets called?
As a half-baked alternative to this patch, there's a generic
optimization for this case. do_shared_fault normally calls
do_page_mkwrite and installs the resulting page with the writable bit
set. But if __do_fault returns VM_FAULT_NOPAGE, then this
optimization is skipped. Could be add VM_FAULT_NOPAGE_READONLY (or
VM_FAULT_NOPAGE | VM_FAULT_READONLY) as a hint that a page was
installed but that it was installed readonly? If we did that, then
do_shared_fault could check that bit and go through the wp_page logic
rather than returning to userspace.
--Andy
--
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:[~2016-01-27 6:02 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-25 17:25 [PATCH 0/3] Fixes for vm_insert_pfn_prot() Matthew Wilcox
2016-01-25 17:25 ` [PATCH 1/3] x86: Honour passed pgprot in track_pfn_insert() and track_pfn_remap() Matthew Wilcox
2016-01-25 17:33 ` Andy Lutomirski
2016-01-25 17:46 ` Andy Lutomirski
2016-01-27 4:40 ` Matthew Wilcox
2016-01-27 5:44 ` Andy Lutomirski
2016-01-29 14:49 ` Matthew Wilcox
2016-01-29 22:19 ` Andy Lutomirski
2016-02-09 14:24 ` Ingo Molnar
2016-02-10 3:06 ` Andy Lutomirski
2016-01-25 17:25 ` [PATCH 2/3] mm: Convert vm_insert_pfn_prot to vmf_insert_pfn_prot Matthew Wilcox
2016-01-25 17:35 ` Andy Lutomirski
2016-01-27 4:18 ` Matthew Wilcox
2016-01-25 17:25 ` [PATCH 3/3] dax: Handle write faults more efficiently Matthew Wilcox
2016-01-25 17:38 ` Andy Lutomirski
2016-01-27 4:17 ` Matthew Wilcox
2016-01-27 5:22 ` Andy Lutomirski
2016-01-27 6:01 ` Andy Lutomirski [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=CALCETrXdCWtsLxhx_DqNPEma4mo71iTXF-FTVzSOfD9HDaiqhg@mail.gmail.com \
--to=luto@amacapital.net \
--cc=akpm@linux-foundation.org \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=matthew.r.wilcox@intel.com \
--cc=mingo@redhat.com \
--cc=willy@linux.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