[PATCH] ~/kernel/sys.c (2.5.64) (trivial)

From: Jay Patrick Howard (jhoward@feeding.frenzy.com)
Date: Tue Mar 11 2003 - 23:49:09 EST


Apologies in advance if this is so trivial as to be non-patch-worthy.

Was poking around and noticed a possible improvement to kernekl/sys.c.
This change results in marginally better output using gcc 3.2 on x86.

As a test I constructed look-alike functions and a small driver. There
appeared to be a ~40% speedup on the "true" branch and ~5% slowdown on the
"false" branch. No effort was made to account for overhead when figuring
the percentages.

Unfortunately I don't know enough to say which side of the branch is more
commonly taken.

--- linux-2.5.64.orig/kernel/sys.c Tue Mar 4 21:28:58 2003
+++ linux-2.5.64/kernel/sys.c Tue Mar 11 22:06:12 2003
@@ -1096,18 +1096,12 @@
  */
 int in_group_p(gid_t grp)
 {
- int retval = 1;
- if (grp != current->fsgid)
- retval = supplemental_group_member(grp);
- return retval;
+ return (grp != current->fsgid) ? supplemental_group_member(grp) : 1;
 }

 int in_egroup_p(gid_t grp)
 {
- int retval = 1;
- if (grp != current->egid)
- retval = supplemental_group_member(grp);
- return retval;
+ return (grp != current->egid) ? supplemental_group_member(grp) : 1;
 }

 DECLARE_RWSEM(uts_sem);

-
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/



This archive was generated by hypermail 2b29 : Sat Mar 15 2003 - 22:00:29 EST