summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@tv-sign.ru>2004-06-08 19:18:25 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-06-08 19:18:25 -0700
commit6aaac55fbc8c5b6991289731f19cd0489403d270 (patch)
treec3b4b4fabab1be974a10a73151c083fc42b3b5ac /kernel
parent754d4c9b21574371164f4eddf740bcbfdd26db01 (diff)
[PATCH] dup_mmap() double memory accounting
dup_mmap() unnecessarily tries to account for memory of the vma's it has created if it fails in the middle. However, that's pointless (and wrong), since the exit_mmap() path called through mmput() will do so anyway in the failure path. Just remove the bogus un-accounting code.
Diffstat (limited to 'kernel')
-rw-r--r--kernel/fork.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index 87f8a21d5ef1..2bd308efea50 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -271,7 +271,6 @@ static inline int dup_mmap(struct mm_struct * mm, struct mm_struct * oldmm)
struct vm_area_struct * mpnt, *tmp, **pprev;
struct rb_node **rb_link, *rb_parent;
int retval;
- unsigned long charge = 0;
struct mempolicy *pol;
down_write(&oldmm->mmap_sem);
@@ -308,7 +307,6 @@ static inline int dup_mmap(struct mm_struct * mm, struct mm_struct * oldmm)
unsigned int len = (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT;
if (security_vm_enough_memory(len))
goto fail_nomem;
- charge += len;
}
tmp = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);
if (!tmp)
@@ -360,7 +358,7 @@ static inline int dup_mmap(struct mm_struct * mm, struct mm_struct * oldmm)
tmp->vm_ops->open(tmp);
if (retval)
- goto fail;
+ goto out;
}
retval = 0;
@@ -372,8 +370,6 @@ fail_nomem_policy:
kmem_cache_free(vm_area_cachep, tmp);
fail_nomem:
retval = -ENOMEM;
-fail:
- vm_unacct_memory(charge);
goto out;
}
static inline int mm_alloc_pgd(struct mm_struct * mm)