mm: use passed vm_fault structure for in wp_pfn_shared()
authorJan Kara <[email protected]>
Wed, 14 Dec 2016 23:07:13 +0000 (15:07 -0800)
committerLinus Torvalds <[email protected]>
Thu, 15 Dec 2016 00:04:09 +0000 (16:04 -0800)
Instead of creating another vm_fault structure, use the one passed to
wp_pfn_shared() for passing arguments into pfn_mkwrite handler.

Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Jan Kara <[email protected]>
Reviewed-by: Ross Zwisler <[email protected]>
Acked-by: Kirill A. Shutemov <[email protected]>
Cc: Dan Williams <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
mm/memory.c

index 78b81e8984df677df5ed3ba1cbb8ddc83b4b4111..7ba9cc58ddddbfcbd8a1b9c674e21709d90fa734 100644 (file)
@@ -2273,16 +2273,11 @@ static int wp_pfn_shared(struct vm_fault *vmf, pte_t orig_pte)
        struct vm_area_struct *vma = vmf->vma;
 
        if (vma->vm_ops && vma->vm_ops->pfn_mkwrite) {
-               struct vm_fault vmf2 = {
-                       .page = NULL,
-                       .pgoff = vmf->pgoff,
-                       .address = vmf->address,
-                       .flags = FAULT_FLAG_WRITE | FAULT_FLAG_MKWRITE,
-               };
                int ret;
 
                pte_unmap_unlock(vmf->pte, vmf->ptl);
-               ret = vma->vm_ops->pfn_mkwrite(vma, &vmf2);
+               vmf->flags |= FAULT_FLAG_MKWRITE;
+               ret = vma->vm_ops->pfn_mkwrite(vma, vmf);
                if (ret & VM_FAULT_ERROR)
                        return ret;
                vmf->pte = pte_offset_map_lock(vma->vm_mm, vmf->pmd,