From: William Lee Irwin III <wli@holomorphy.com>

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 <akpm@osdl.org>
---

 25-akpm/kernel/fork.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)

diff -puN kernel/fork.c~task-statm-dontcopy-fix kernel/fork.c
--- 25/kernel/fork.c~task-statm-dontcopy-fix	2004-08-25 00:34:13.659612456 -0700
+++ 25-akpm/kernel/fork.c	2004-08-25 00:34:13.663611848 -0700
@@ -323,8 +323,11 @@ static inline int dup_mmap(struct mm_str
 	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;
_