Skip to contentSkip to conversation

smp sched typo

PATCH New Jun Sun 1 participant 1 message May 15, 2002 MIPS

lore
Share & tools
lore

Jun Sun

author
#0 lore raw

PATCH 1/1 smp sched typo

Linus,

I found this bug in 2.4 kernel. I have verified that the bug exists on MIPS SMP and PPC SMP, but not on i386 SMP. See the detailed explanation inside the patch.

2.5 sched.c has been re-written quite a bit and does not have this problem.

http://linux.junsun.net/patches/generic/submitted/020515-2.4.18-smp-sched-typo.patch

Jun

Gcc will optimizie out the whole 'if' branch on platforms where cycles_t is not unsigned long long (such as MIPS, PPC).

The symptom for this bug is not fatal - perhaps that is ther reason why nobody has found it so far. Higher priority process will be delayed to start its execution. One of my tests shows on a heavy-loaded system the delay is about 5 to 6 jiffies.

Jun, 020515

kernel/sched.c renamed from kernel/sched.c.orig +1 -1
diff -Nru link/kernel/sched.c.orig link/kernel/sched.c
@@ -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) {