From: Boaz Harrosh <boaz@plexistor.com>
To: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: Dave Chinner <david@fromorbit.com>,
Matthew Wilcox <matthew.r.wilcox@intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Jan Kara <jack@suse.cz>, Hugh Dickins <hughd@google.com>,
Mel Gorman <mgorman@suse.de>,
linux-mm@kvack.org, linux-nvdimm <linux-nvdimm@ml01.01.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
Eryu Guan <eguan@redhat.com>,
Christoph Hellwig <hch@infradead.org>,
Stable Tree <stable@vger.kernel.org>
Subject: Re: [PATCH 1/3] mm(v4.1): New pfn_mkwrite same as page_mkwrite for VM_PFNMAP
Date: Tue, 07 Apr 2015 12:22:42 +0300 [thread overview]
Message-ID: <5523A1E2.6080704@plexistor.com> (raw)
In-Reply-To: <20150407090335.GA12664@node.dhcp.inet.fi>
On 04/07/2015 12:03 PM, Kirill A. Shutemov wrote:
> On Tue, Apr 07, 2015 at 11:40:06AM +0300, Boaz Harrosh wrote:
>>
>> [v2]
>> Based on linux-next/akpm [3dc4623]. For v4.1 merge window
>> Incorporated comments from Andrew And Kirill
>
> Not really. You've ignored most of them. See below.
>
Yes sorry about that I sent the wrong version.
<>
>> ---
>> include/linux/mm.h | 3 +++
>> mm/memory.c | 35 +++++++++++++++++++++++++++++++----
>
> Please, document it in Documentation/filesystems/Locking.
>
Ha, I missed this one. Ok will try to put something coherent.
<>
>> diff --git a/mm/memory.c b/mm/memory.c
>> index 59f6268..6e8f3f6 100644
>> --- a/mm/memory.c
>> +++ b/mm/memory.c
>> @@ -1982,6 +1982,19 @@ static int do_page_mkwrite(struct vm_area_struct *vma, struct page *page,
>> return ret;
>> }
>>
>> +static int do_pfn_mkwrite(struct vm_area_struct *vma, unsigned long address)
>> +{
>> + struct vm_fault vmf = {
>> + .page = 0,
>
> .page = NULL,
>
>> + .pgoff = (((address & PAGE_MASK) - vma->vm_start)
>> + >> PAGE_SHIFT) + vma->vm_pgoff,
>
> .pgoff = linear_page_index(vma, address),
>
Yes I had fixes for these two
>> + .virtual_address = (void __user *)(address & PAGE_MASK),
>> + .flags = FAULT_FLAG_WRITE | FAULT_FLAG_MKWRITE,
>> + };
>> +
>> + return vma->vm_ops->pfn_mkwrite(vma, &vmf);
>> +}
>> +
>> /*
>> * Handle write page faults for pages that can be reused in the current vma
>> *
>> @@ -2259,14 +2272,28 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
>> * VM_PFNMAP VMA.
>> *
>> * We should not cow pages in a shared writeable mapping.
>> - * Just mark the pages writable as we can't do any dirty
>> - * accounting on raw pfn maps.
>> + * Just mark the pages writable and/or call ops->pfn_mkwrite.
>> */
>> if ((vma->vm_flags & (VM_WRITE|VM_SHARED)) ==
>> - (VM_WRITE|VM_SHARED))
>> + (VM_WRITE|VM_SHARED)) {
>
> Let's move this case in separate function -- wp_pfn_shared(). As we do for
> wp_page_shared().
>
Ha, OK I will try that. I will need to re-run tests to make sure I did
not mess up
Thanks will fix, makes sense
Boaz
>> + if (vma->vm_ops && vma->vm_ops->pfn_mkwrite) {
>> + int ret;
>> +
>> + pte_unmap_unlock(page_table, ptl);
>> + ret = do_pfn_mkwrite(vma, address);
>> + if (ret & VM_FAULT_ERROR)
>> + return ret;
>> + page_table = pte_offset_map_lock(mm, pmd,
>> + address, &ptl);
>> + /* Did pfn_mkwrite already fixed up the pte */
>> + if (!pte_same(*page_table, orig_pte)) {
>> + pte_unmap_unlock(page_table, ptl);
>> + return ret;
>> + }
>> + }
>> return wp_page_reuse(mm, vma, address, page_table, ptl,
>> orig_pte, old_page, 0, 0);
>> -
>> + }
>> pte_unmap_unlock(page_table, ptl);
>> return wp_page_copy(mm, vma, address, page_table, pmd,
>> orig_pte, old_page);
--
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:[~2015-04-07 9:22 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-07 8:33 [PATCH 0/3 v5] dax: some dax fixes and cleanups Boaz Harrosh
2015-04-07 8:40 ` [PATCH 1/3] mm(v4.1): New pfn_mkwrite same as page_mkwrite for VM_PFNMAP Boaz Harrosh
2015-04-07 8:51 ` Boaz Harrosh
2015-04-07 9:03 ` Kirill A. Shutemov
2015-04-07 9:22 ` Boaz Harrosh [this message]
2015-04-07 12:57 ` [PATCH 1/3 v6] " Boaz Harrosh
2015-04-07 13:17 ` Kirill A. Shutemov
2015-04-07 13:26 ` Kirill A. Shutemov
2015-04-07 13:37 ` Boaz Harrosh
2015-04-07 13:47 ` Kirill A. Shutemov
2015-04-07 14:09 ` Boaz Harrosh
2015-04-07 14:06 ` [PATCH 1/3 v7] " Boaz Harrosh
2015-04-07 14:12 ` Kirill A. Shutemov
2015-04-07 8:43 ` [PATCH 2/3] dax: use pfn_mkwrite to update c/mtime + freeze protection Boaz Harrosh
2015-04-07 16:28 ` Jan Kara
2015-04-07 8:45 ` [PATCH 3/3] dax: Unify ext2/4_{dax,}_file_operations Boaz Harrosh
2015-04-07 16:26 ` Jan Kara
2015-04-08 15:56 ` [PATCH 1/3 @stable] mm(v4.0): New pfn_mkwrite same as page_mkwrite for VM_PFNMAP Boaz Harrosh
2015-04-08 16:00 ` Boaz Harrosh
2015-04-08 20:26 ` Greg KH
2015-04-12 7:49 ` Boaz Harrosh
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=5523A1E2.6080704@plexistor.com \
--to=boaz@plexistor.com \
--cc=akpm@linux-foundation.org \
--cc=david@fromorbit.com \
--cc=eguan@redhat.com \
--cc=hch@infradead.org \
--cc=hughd@google.com \
--cc=jack@suse.cz \
--cc=kirill.shutemov@linux.intel.com \
--cc=kirill@shutemov.name \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-nvdimm@ml01.01.org \
--cc=matthew.r.wilcox@intel.com \
--cc=mgorman@suse.de \
--cc=stable@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).