linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Heusden, Folkert van" <f.v.heusden@ftr.nl>
To: Linux Kernel Development <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@transmeta.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: [PATCH] kernel/exit.c - 2.4.2 - small optimalisation (very small) to do_exit()
Date: Mon, 26 Mar 2001 11:45:14 +0200	[thread overview]
Message-ID: <27525795B28BD311B28D00500481B7601F10A1@ftrs1.intranet.ftr.nl> (raw)

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 ]


                 reply	other threads:[~2001-03-26  9:46 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=27525795B28BD311B28D00500481B7601F10A1@ftrs1.intranet.ftr.nl \
    --to=f.v.heusden@ftr.nl \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).