* [PATCH] dup_mmap tiny optimization
@ 2002-11-18 16:15 Luca Barbieri
0 siblings, 0 replies; only message in thread
From: Luca Barbieri @ 2002-11-18 16:15 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Linux-Kernel ML
[-- Attachment #1: Type: text/plain, Size: 925 bytes --]
This patch moves retval = -ENOMEM out of the vma loop and after the
fail_nomem label.
The fail label is added and is used when retval is already set.
--- linux-2.5.48_ldb/kernel/fork.c~ 2002-11-18 05:29:22.000000000 +0100
+++ linux-2.5.48_ldb/kernel/fork.c 2002-11-18 17:08:55.000000000 +0100
@@ -238,7 +238,6 @@ static inline int dup_mmap(struct mm_str
for (mpnt = current->mm->mmap ; mpnt ; mpnt = mpnt->vm_next) {
struct file *file;
- retval = -ENOMEM;
if(mpnt->vm_flags & VM_DONTCOPY)
continue;
if (mpnt->vm_flags & VM_ACCOUNT) {
@@ -283,7 +282,7 @@ static inline int dup_mmap(struct mm_str
tmp->vm_ops->open(tmp);
if (retval)
- goto fail_nomem;
+ goto fail;
}
retval = 0;
build_mmap_rb(mm);
@@ -293,6 +292,8 @@ out:
up_write(&oldmm->mmap_sem);
return retval;
fail_nomem:
+ retval = -ENOMEM;
+ fail:
vm_unacct_memory(charge);
goto out;
}
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-11-18 16:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-18 16:15 [PATCH] dup_mmap tiny optimization Luca Barbieri
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox