]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - mm/mremap.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/shaggy...
[karo-tx-linux.git] / mm / mremap.c
index ec7238a78f36c5eeac4bf1954e215399428a858d..f343fc73a8bdd7f0ecd68fb1674438033c85cc49 100644 (file)
@@ -141,6 +141,10 @@ move_one_page(struct vm_area_struct *vma, unsigned long old_addr,
                        if (dst) {
                                pte_t pte;
                                pte = ptep_clear_flush(vma, old_addr, src);
+
+                               /* ZERO_PAGE can be dependant on virtual addr */
+                               pte = move_pte(pte, new_vma->vm_page_prot,
+                                                       old_addr, new_addr);
                                set_pte_at(mm, new_addr, dst, pte);
                        } else
                                error = -ENOMEM;
@@ -229,6 +233,7 @@ static unsigned long move_vma(struct vm_area_struct *vma,
         * since do_munmap() will decrement it by old_len == new_len
         */
        mm->total_vm += new_len >> PAGE_SHIFT;
+       __vm_stat_account(mm, vma->vm_flags, vma->vm_file, new_len>>PAGE_SHIFT);
 
        if (do_munmap(mm, old_addr, old_len) < 0) {
                /* OOM: unable to split vma, just get accounts right */
@@ -243,7 +248,6 @@ static unsigned long move_vma(struct vm_area_struct *vma,
                        vma->vm_next->vm_flags |= VM_ACCOUNT;
        }
 
-       __vm_stat_account(mm, vma->vm_flags, vma->vm_file, new_len>>PAGE_SHIFT);
        if (vm_flags & VM_LOCKED) {
                mm->locked_vm += new_len >> PAGE_SHIFT;
                if (new_len > old_len)