Commit 9ceab3e2 authored by Hugh Dickins's avatar Hugh Dickins Committed by Linus Torvalds

[PATCH] statm: fix negative data

The sixth "data" field of /proc/$pid/statm was sometimes negative: text is
a subset of shared_vm, and so was subtracted twice from total_vm.
Signed-off-by: default avatarHugh Dickins <hugh@veritas.com>
Acked-by: default avatarWilliam Irwin <wli@holomorphy.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 8586febd
...@@ -40,7 +40,7 @@ int task_statm(struct mm_struct *mm, int *shared, int *text, ...@@ -40,7 +40,7 @@ int task_statm(struct mm_struct *mm, int *shared, int *text,
*shared = mm->rss - mm->anon_rss; *shared = mm->rss - mm->anon_rss;
*text = (PAGE_ALIGN(mm->end_code) - (mm->start_code & PAGE_MASK)) *text = (PAGE_ALIGN(mm->end_code) - (mm->start_code & PAGE_MASK))
>> PAGE_SHIFT; >> PAGE_SHIFT;
*data = mm->total_vm - mm->shared_vm - *text; *data = mm->total_vm - mm->shared_vm;
*resident = mm->rss; *resident = mm->rss;
return mm->total_vm; return mm->total_vm;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment