On Wed, 9 Feb 2000, Tigran Aivazian wrote:
> Hi Linus,
>
> The patch below does this to fs/open.c:sys_vhangup()
>
> a) removes a goto
>
> b) removes a local variable
>
> c) reduces the length of holding big kernel lock
If you're going to "optimize" things, don't make the code generated worse
by introducing a branch in the normal case. Yeash. (Below is an
untested, hand edited version of the previous patch.)
-ben
--- open.c.0 Wed Feb 9 12:53:07 2000
+++ open.c Wed Feb 9 12:53:44 2000
@@ -898,16 +898,9 @@
*/
asmlinkage long sys_vhangup(void)
{
- int ret = -EPERM;
-
- if (!capable(CAP_SYS_TTY_CONFIG))
- goto out;
- /* If there is a controlling tty, hang it up */
- lock_kernel();
- if (current->tty)
- tty_vhangup(current->tty);
- if (current->tty)
- unlock_kernel();
- ret = 0;
-out:
- return ret;
+ if (capable(CAP_SYS_TTY_CONFIG)) {
+ if (current->tty)
+ tty_vhangup(current->tty);
+ return 0;
+ }
+ return -EPERM;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Tue Feb 15 2000 - 21:00:15 EST