summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKirill Korotaev <dev@sw.ru>2005-05-16 21:53:18 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-17 07:59:12 -0700
commit7179906293ebdc333f14a03d3e58b03604848f3c (patch)
tree48623522c6af985400e6181ce1b18d98b910c0fc
parent202d182a92c60416680e31baa697faa60b0882f5 (diff)
downloadop-kernel-dev-7179906293ebdc333f14a03d3e58b03604848f3c.zip
op-kernel-dev-7179906293ebdc333f14a03d3e58b03604848f3c.tar.gz
[PATCH] mm acct accounting fix
This patch fixes mm->total_vm and mm->locked_vm acctounting in case when move_page_tables() fails inside move_vma(). Signed-Off-By: Kirill Korotaev <dev@sw.ru> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--mm/mremap.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/mm/mremap.c b/mm/mremap.c
index 0dd7ace..ec7238a 100644
--- a/mm/mremap.c
+++ b/mm/mremap.c
@@ -224,6 +224,12 @@ 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;
+
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,7 +243,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;
OpenPOWER on IntegriCloud