[PATCH] kernel/exit.c - 2.4.2 - small optimalisation (very small)

Heusden, Folkert van (f.v.heusden@ftr.nl)
Mon, 26 Mar 2001 11:45:14 +0200


Hi,

This very small patches re-orders 2 if-statements so that in the
most common case 1 less if-statement is executed, in the worst
case the same number of if-statements is executed (doesn't matter
though: it's would be the fault-situation anyway).

diff -ur --minimal linux-vanilla/kernel/exit.c linux-2.4.2/kernel/exit.c
--- linux-vanilla/kernel/exit.c Mon Mar 26 09:28:13 2001
+++ linux-2.4.2/kernel/exit.c Mon Mar 26 10:50:30 2001
@@ -425,10 +425,12 @@

if (in_interrupt())
panic("Aiee, killing interrupt handler!");
- if (!tsk->pid)
- panic("Attempted to kill the idle task!");
- if (tsk->pid == 1)
- panic("Attempted to kill init!");
+ if (tsk->pid <= 1) {
+ if (tsk->pid)
+ panic("Attempted to kill init!");
+ else
+ panic("Attempted to kill the idle task!");
+ }
tsk->flags |= PF_EXITING;
del_timer_sync(&tsk->real_timer);

Greetings,

Folkert van Heusden (folkert@vanheusden.com)
[ www.vanheusden.com ]

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