Skip to contentSkip to conversation

One-liner typo 2.5.3-pre3 in ppc/kernel/idle.c

PATCH In review Rusty Russell 2 participants 3 messages Jan 23, 2002

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 One-liner typo 2.5.3-pre3 in ppc/kernel/idle.c

Looks like need_resched conversion error.

Cheers!
Rusty.

arch/ppc/kernel/idle.c +1 -1
diff -urN -I \$.*\$ --exclude TAGS -X /home/rusty/devel/kernel/kernel-patches/current-dontdiff --minimal linux-2.5.3-pre3/arch/ppc/kernel/idle.c linux-2.5.3-pre3.28518.updated/arch/ppc/kernel/idle.c
@@ -66,7 +67,7 @@
 			int oldval = xchg(&current->need_resched, -1);
 
 			if (!oldval) {
-				while (need_resched())
+				while (!need_resched())
 					barrier(); /* Do Nothing */
 			}
 		}

--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.

#1 lore raw
Quoted 2 lines

Looks like need_resched conversion error.

Actually there is a (badly commented) optimisation here. (OK so it isn't commented at all :)

The code used to say:

        int oldval = xchg(&current->need_resched, -1);

	if (!oldval) {
		while(current->need_resched == -1)
			; /* Do Nothing */
	}

We atomically grab the current value of need_resched and replace it with -1. The -1 tells the scheduler that we are busy looping and it doesnt need to send an IPI to force a reschedule.

Anton

#2 lore raw

In message <20020123053118.GB14366@krispykreme> you write:

Quoted 3 lines

We atomically grab the current value of need_resched and replace it with -1. The -1 tells the scheduler that we are busy looping and it doesnt need to send an IPI to force a reschedule.

Yes, but the replacment loop was completely wrong. Sure, with my patch this optimization isn't there, but at least it will work as designed...

Cheers!
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.