* [PATCH] Simplify last lib/idr.c change
@ 2004-09-23 6:06 Ulrich Drepper
0 siblings, 0 replies; only message in thread
From: Ulrich Drepper @ 2004-09-23 6:06 UTC (permalink / raw)
To: Linux Kernel, Andrew Morton
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
The last change to alloc_layer in lib/idr.c unnecessarily complicates
the code and depending on the definition of spin_unlock will cause worse
code to be generated than necessary. The following patch should improve
the situation.
Signed-off-by: Ulrich Drepper <drepper@redhat.com>
- --- lib/idr.c-old 2004-09-22 23:02:15.000000000 -0700
+++ lib/idr.c 2004-09-22 23:03:06.000000000 -0700
@@ -39,13 +39,11 @@ static struct idr_layer *alloc_layer(str
struct idr_layer *p;
spin_lock(&idp->lock);
- - if (!(p = idp->id_free)) {
- - spin_unlock(&idp->lock);
- - return NULL;
+ if ((p = idp->id_free)) {
+ idp->id_free = p->ary[0];
+ idp->id_free_cnt--;
+ p->ary[0] = NULL;
}
- - idp->id_free = p->ary[0];
- - idp->id_free_cnt--;
- - p->ary[0] = NULL;
spin_unlock(&idp->lock);
return(p);
}
- --
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
iD8DBQFBUmfk2ijCOnn/RHQRAvJ4AKCpd1bkrRkcHaDm+mDyfh1tMpj9EgCgqu2N
voeHnNuVH5cpBCDtafFjZoc=
=XUFL
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-09-23 6:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-23 6:06 [PATCH] Simplify last lib/idr.c change Ulrich Drepper
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox