From: Boaz Harrosh <boaz@plexistor.com>
To: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Dan Williams <dan.j.williams@intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
Matthew Wilcox <willy@linux.intel.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>
Cc: Ross Zwisler <ross.zwisler@linux.intel.com>,
Oleg Nesterov <oleg@redhat.com>, Mel Gorman <mgorman@suse.de>,
Johannes Weiner <hannes@cmpxchg.org>
Subject: [PATCH 2/2] dax: Only fault once on mmap write access
Date: Sun, 10 Jan 2016 16:03:43 +0200 [thread overview]
Message-ID: <569264BF.8010905@plexistor.com> (raw)
In-Reply-To: <569263BA.5060503@plexistor.com>
In current code for any mmap-write access there are two page faults.
One that maps the pfn into the vma (vm_insert_mixed()), and a second
one that converts the read-only mapping to read-write (via pfn_mkwrite).
But since we already know that this is a write access we can map the
pfn read-write and save the extra fault.
Signed-off-by: Boaz Harrosh <boaz@plexistor.com>
---
fs/dax.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/fs/dax.c b/fs/dax.c
index a86d3cc..3fee696 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -289,6 +289,7 @@ static int dax_insert_mapping(struct inode *inode, struct buffer_head *bh,
sector_t sector = bh->b_blocknr << (inode->i_blkbits - 9);
unsigned long vaddr = (unsigned long)vmf->virtual_address;
void __pmem *addr;
+ pgprot_t prot = vma->vm_page_prot;
unsigned long pfn;
pgoff_t size;
int error;
@@ -321,7 +322,10 @@ static int dax_insert_mapping(struct inode *inode, struct buffer_head *bh,
wmb_pmem();
}
- error = vm_insert_mixed(vma, vaddr, pfn);
+ if (vmf->flags & FAULT_FLAG_WRITE)
+ prot = pgprot_modify(prot, PAGE_SHARED);
+
+ error = vm_insert_mixed_prot(vma, vaddr, pfn, prot);
out:
i_mmap_unlock_read(mapping);
--
1.9.3
--
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:[~2016-01-10 14:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-10 13:59 [PATCHSET 0/2] Allow single pagefault in write access of a VM_MIXEDMAP mapping Boaz Harrosh
2016-01-10 14:02 ` [PATCH 1/2] mm: Allow single pagefault on mmap-write with VM_MIXEDMAP Boaz Harrosh
2016-01-10 14:03 ` Boaz Harrosh [this message]
2016-01-11 1:19 ` [PATCHSET 0/2] Allow single pagefault in write access of a VM_MIXEDMAP mapping Dan Williams
2016-01-11 9:22 ` Boaz Harrosh
2016-01-11 16:37 ` Dan Williams
2016-01-11 19:35 ` Matthew Wilcox
2016-01-12 13:29 ` Matthew Wilcox
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=569264BF.8010905@plexistor.com \
--to=boaz@plexistor.com \
--cc=akpm@linux-foundation.org \
--cc=dan.j.williams@intel.com \
--cc=hannes@cmpxchg.org \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-mm@kvack.org \
--cc=mgorman@suse.de \
--cc=oleg@redhat.com \
--cc=ross.zwisler@linux.intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.