mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Isaacson <adi@hexapodia.org>
To: linux-kernel@vger.kernel.org
Subject: typecast bug in sched.c bites reschedule_idle on alpha
Date: Thu, 17 Jul 2003 16:51:39 -0500	[thread overview]
Message-ID: <20030717165139.B12164@hexapodia.org> (raw)

On SMP Alpha, a saturated system (with one busy userland process per
CPU) becomes almost completely unusable.  The busy loops don't have to
be doing anything more complicated than "while(1) ;".  The symptom is
that even logging into the system (with ssh) takes on the order of 30
seconds.  (Tested on an ES40 with 4 processors, 2.4.18.)

It turns out that the problem is in kernel/schedule.c:reschedule_idle.

        cycles_t oldest_idle;
...
        oldest_idle = (cycles_t) -1;
...
                        if (oldest_idle == -1ULL) {

Since asm-alpha/timex.h defines cycles_t as unsigned int, this
comparison is always false.  Changing it to (cycles_t)-1 fixes the
problem.

Patch below.  I'd like this to go into 2.4.22, if nobody has a problem
with that.  I would like confirmation from other eyes -- this patch
doesn't break semantics on any architecture, does it?

-andy

--- linux-2.4.21/kernel/sched.c	Thu Jul 17 16:43:37 2003
+++ linux-2.4.21-idle-fix/kernel/sched.c	Thu Jul 17 16:23:25 2003
@@ -282,7 +282,7 @@
 				target_tsk = tsk;
 			}
 		} else {
-			if (oldest_idle == -1ULL) {
+			if (oldest_idle == (cycles_t)-1) {
 				int prio = preemption_goodness(tsk, p, cpu);
 
 				if (prio > max_prio) {
@@ -294,7 +294,7 @@
 	}
 	tsk = target_tsk;
 	if (tsk) {
-		if (oldest_idle != -1ULL) {
+		if (oldest_idle != (cycles_t)-1) {
 			best_cpu = tsk->processor;
 			goto send_now_idle;
 		}

             reply	other threads:[~2003-07-17 21:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-17 21:51 Andy Isaacson [this message]
2003-07-17 22:20 ` Ivan Kokshaysky
2003-07-17 22:28   ` Andy Isaacson

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=20030717165139.B12164@hexapodia.org \
    --to=adi@hexapodia.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®