Merge branch 'master' of git://1984.lsi.us.es/nf
[deliverable/linux.git] / mm / memory.c
index b03a4a21c1d02ff6c0ceb5656d33fdf43fd53c9a..fb135ba4aba90349e58c79d49838860cb7db8105 100644 (file)
@@ -1528,7 +1528,7 @@ struct page *follow_page(struct vm_area_struct *vma, unsigned long address,
                                spin_unlock(&mm->page_table_lock);
                                wait_split_huge_page(vma->anon_vma, pmd);
                        } else {
-                               page = follow_trans_huge_pmd(mm, address,
+                               page = follow_trans_huge_pmd(vma, address,
                                                             pmd, flags);
                                spin_unlock(&mm->page_table_lock);
                                goto out;
@@ -2148,7 +2148,7 @@ out:
  * @addr: target user address of this page
  * @pfn: source kernel pfn
  *
- * Similar to vm_inert_page, this allows drivers to insert individual pages
+ * Similar to vm_insert_page, this allows drivers to insert individual pages
  * they've allocated into a user vma. Same comments apply.
  *
  * This function should only be called from a vm_ops->fault handler, and
@@ -2527,6 +2527,9 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
        int ret = 0;
        int page_mkwrite = 0;
        struct page *dirty_page = NULL;
+       unsigned long mmun_start;       /* For mmu_notifiers */
+       unsigned long mmun_end;         /* For mmu_notifiers */
+       bool mmun_called = false;       /* For mmu_notifiers */
 
        old_page = vm_normal_page(vma, address, orig_pte);
        if (!old_page) {
@@ -2704,6 +2707,11 @@ gotten:
        if (mem_cgroup_newpage_charge(new_page, mm, GFP_KERNEL))
                goto oom_free_new;
 
+       mmun_start  = address & PAGE_MASK;
+       mmun_end    = (address & PAGE_MASK) + PAGE_SIZE;
+       mmun_called = true;
+       mmu_notifier_invalidate_range_start(mm, mmun_start, mmun_end);
+
        /*
         * Re-check the pte - we dropped the lock
         */
@@ -2766,14 +2774,12 @@ gotten:
        } else
                mem_cgroup_uncharge_page(new_page);
 
+       if (new_page)
+               page_cache_release(new_page);
 unlock:
        pte_unmap_unlock(page_table, ptl);
-       if (new_page) {
-               if (new_page == old_page)
-                       /* cow happened, notify before releasing old_page */
-                       mmu_notifier_invalidate_page(mm, address);
-               page_cache_release(new_page);
-       }
+       if (mmun_called)
+               mmu_notifier_invalidate_range_end(mm, mmun_start, mmun_end);
        if (old_page) {
                /*
                 * Don't let another task, with possibly unlocked vma,
This page took 0.03076 seconds and 5 git commands to generate.