[PATCH] dup_mmap tiny optimization

Luca Barbieri (ldb@ldb.ods.org)
18 Nov 2002 17:15:28 +0100


--=-VjG8IfptYwcgTUKvlMct
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

This patch moves retval =3D -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 =3D current->mm->mmap ; mpnt ; mpnt =3D mpnt->vm_next) {
struct file *file;
=20
- retval =3D -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);
=20
if (retval)
- goto fail_nomem;
+ goto fail;
}
retval =3D 0;
build_mmap_rb(mm);
@@ -293,6 +292,8 @@ out:
up_write(&oldmm->mmap_sem);
return retval;
fail_nomem:
+ retval =3D -ENOMEM;
+ fail:
vm_unacct_memory(charge);
goto out;
}

--=-VjG8IfptYwcgTUKvlMct
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQA92RIfdjkty3ft5+cRAoDxAKCy87TgdRc2Ps16H4dKvVyNI+DwrACggHjr
O9W5b6pFCi1hEWYoM7Pi0So=
=Pddj
-----END PGP SIGNATURE-----

--=-VjG8IfptYwcgTUKvlMct--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/