Commit 7179906293ebdc333f14a03d3e58b03604848f3c
Committed by
Linus Torvalds
1 parent
202d182a92
Exists in
master
and in
39 other branches
[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>
Showing 1 changed file with 6 additions and 1 deletions Side-by-side Diff
mm/mremap.c
... | ... | @@ -224,6 +224,12 @@ |
224 | 224 | split = 1; |
225 | 225 | } |
226 | 226 | |
227 | + /* | |
228 | + * if we failed to move page tables we still do total_vm increment | |
229 | + * since do_munmap() will decrement it by old_len == new_len | |
230 | + */ | |
231 | + mm->total_vm += new_len >> PAGE_SHIFT; | |
232 | + | |
227 | 233 | if (do_munmap(mm, old_addr, old_len) < 0) { |
228 | 234 | /* OOM: unable to split vma, just get accounts right */ |
229 | 235 | vm_unacct_memory(excess >> PAGE_SHIFT); |
... | ... | @@ -237,7 +243,6 @@ |
237 | 243 | vma->vm_next->vm_flags |= VM_ACCOUNT; |
238 | 244 | } |
239 | 245 | |
240 | - mm->total_vm += new_len >> PAGE_SHIFT; | |
241 | 246 | __vm_stat_account(mm, vma->vm_flags, vma->vm_file, new_len>>PAGE_SHIFT); |
242 | 247 | if (vm_flags & VM_LOCKED) { |
243 | 248 | mm->locked_vm += new_len >> PAGE_SHIFT; |