From: Luca Barbieri <ldb@ldb.ods.org>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Linux-Kernel ML <linux-kernel@vger.kernel.org>
Subject: [PATCH] dup_mmap tiny optimization
Date: 18 Nov 2002 17:15:28 +0100 [thread overview]
Message-ID: <1037636128.1774.154.camel@ldb> (raw)
[-- 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 --]
reply other threads:[~2002-11-18 16:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1037636128.1774.154.camel@ldb \
--to=ldb@ldb.ods.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.