diff options
author | Hugh Dickins <hugh@veritas.com> | 2005-08-04 16:07:09 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-08-04 16:11:15 -0400 |
commit | 1c5ad84516ae7ea4ec868436a910a6bd8d20215a (patch) | |
tree | 929e03789ee2191bbebe45fbd9b6c50865c5f9ca | |
parent | e234f35c54a30d040313e40833dcf623d14629b4 (diff) |
[PATCH] fix VmSize and VmData after mremap
mremap's move_vma is applying __vm_stat_account to the old vma which may
have already been freed: move it to just before the do_munmap.
mremapping to and fro with CONFIG_DEBUG_SLAB=y showed /proc/<pid>/status
VmSize and VmData wrapping just like in kernel bugzilla #4842, and fixed by
this patch - worth including in 2.6.13, though not yet confirmed that it
fixes that specific report from Frank van Maarseveen.
Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | mm/mremap.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/mremap.c b/mm/mremap.c index ec7238a78f36..fc45dc9a617b 100644 --- a/mm/mremap.c +++ b/mm/mremap.c | |||
@@ -229,6 +229,7 @@ static unsigned long move_vma(struct vm_area_struct *vma, | |||
229 | * since do_munmap() will decrement it by old_len == new_len | 229 | * since do_munmap() will decrement it by old_len == new_len |
230 | */ | 230 | */ |
231 | mm->total_vm += new_len >> PAGE_SHIFT; | 231 | mm->total_vm += new_len >> PAGE_SHIFT; |
232 | __vm_stat_account(mm, vma->vm_flags, vma->vm_file, new_len>>PAGE_SHIFT); | ||
232 | 233 | ||
233 | if (do_munmap(mm, old_addr, old_len) < 0) { | 234 | if (do_munmap(mm, old_addr, old_len) < 0) { |
234 | /* OOM: unable to split vma, just get accounts right */ | 235 | /* OOM: unable to split vma, just get accounts right */ |
@@ -243,7 +244,6 @@ static unsigned long move_vma(struct vm_area_struct *vma, | |||
243 | vma->vm_next->vm_flags |= VM_ACCOUNT; | 244 | vma->vm_next->vm_flags |= VM_ACCOUNT; |
244 | } | 245 | } |
245 | 246 | ||
246 | __vm_stat_account(mm, vma->vm_flags, vma->vm_file, new_len>>PAGE_SHIFT); | ||
247 | if (vm_flags & VM_LOCKED) { | 247 | if (vm_flags & VM_LOCKED) { |
248 | mm->locked_vm += new_len >> PAGE_SHIFT; | 248 | mm->locked_vm += new_len >> PAGE_SHIFT; |
249 | if (new_len > old_len) | 249 | if (new_len > old_len) |