From bc5184b165b855bb02e22e0b09cf195b3e37059e Mon Sep 17 00:00:00 2001 From: William Lee Irwin III Date: Thu, 26 Aug 2004 20:37:01 -0700 Subject: [PATCH] [PATCH] Unaccount VM_DONTCOPY vmas properly 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. Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- kernel/fork.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/fork.c b/kernel/fork.c index 6074fa10410af..fed7a0772660e 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -317,8 +317,11 @@ static inline int dup_mmap(struct mm_struct * mm, struct mm_struct * oldmm) 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; -- 2.53.0