Re: fix text reporting in O(1) proc_pid_statm()

From: William Lee Irwin III
Date: Tue Aug 24 2004 - 18:34:13 EST


On Tue, Aug 24, 2004 at 04:12:36PM -0700, William Lee Irwin III wrote:
>> This would not be difficult to perform additional accounting for.
>> I'll follow up with that shortly.

On Tue, Aug 24, 2004 at 04:18:41PM -0700, William Lee Irwin III wrote:
> Account reserved memory properly as per acahalan's sepecified semantics.

Unrelated fix. Unaccount VM_DONTCOPY vmas properly; the child inherits
the whole of the parent's virtual accounting from the memcpy() in
copy_mm(), but the VM_DONTCOPY check here is where a decision is made
for the child not to inherit the vmas corresponding to some accounted
memory usages. Hence, unaccount them when skipping over them here.


-- wli

Index: mm4-2.6.8.1/kernel/fork.c
===================================================================
--- mm4-2.6.8.1.orig/kernel/fork.c 2004-08-23 16:19:50.000000000 -0700
+++ mm4-2.6.8.1/kernel/fork.c 2004-08-24 16:19:45.404121128 -0700
@@ -391,8 +391,11 @@
for (mpnt = current->mm->mmap ; mpnt ; mpnt = mpnt->vm_next) {
struct file *file;

- if(mpnt->vm_flags & VM_DONTCOPY)
+ if (mpnt->vm_flags & VM_DONTCOPY) {
+ __vm_stat_account(mm, mpnt->vm_flags, mpnt->vm_file,
+ -vma_pages(mpnt));
continue;
+ }
charge = 0;
if (mpnt->vm_flags & VM_ACCOUNT) {
unsigned int len = (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/