X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=mm%2Fmremap.c;h=fc45dc9a617b013f4db5aea5fe7898bf6cd677b6;hb=916fa469ab2248d86473577dda72003df599879b;hp=0dd7ace94e519d13f96d601bc1ecc543bb8ac595;hpb=27b030d58c8e72fc7a95187a791bd9406e350f02;p=linux-2.6 diff --git a/mm/mremap.c b/mm/mremap.c index 0dd7ace94e..fc45dc9a61 100644 --- a/mm/mremap.c +++ b/mm/mremap.c @@ -224,6 +224,13 @@ static unsigned long move_vma(struct vm_area_struct *vma, split = 1; } + /* + * if we failed to move page tables we still do total_vm increment + * 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 */ vm_unacct_memory(excess >> PAGE_SHIFT); @@ -237,8 +244,6 @@ static unsigned long move_vma(struct vm_area_struct *vma, vma->vm_next->vm_flags |= VM_ACCOUNT; } - mm->total_vm += new_len >> PAGE_SHIFT; - __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)