All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] One-liner typo 2.5.3-pre3 in ppc/kernel/idle.c
@ 2002-01-23  4:41 Rusty Russell
  2002-01-23  5:31 ` Anton Blanchard
  0 siblings, 1 reply; 3+ messages in thread
From: Rusty Russell @ 2002-01-23  4:41 UTC (permalink / raw)
  To: paulus; +Cc: linux-kernel

Looks like need_resched conversion error.

Cheers!
Rusty.
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
--- linux-2.5.3-pre3/arch/ppc/kernel/idle.c	Wed Jan 23 15:38:36 2002
+++ linux-2.5.3-pre3.28518.updated/arch/ppc/kernel/idle.c	Wed Jan 23 15:39:08 2002
@@ -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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] One-liner typo 2.5.3-pre3 in ppc/kernel/idle.c
  2002-01-23  4:41 [PATCH] One-liner typo 2.5.3-pre3 in ppc/kernel/idle.c Rusty Russell
@ 2002-01-23  5:31 ` Anton Blanchard
  2002-01-23  6:00   ` Rusty Russell
  0 siblings, 1 reply; 3+ messages in thread
From: Anton Blanchard @ 2002-01-23  5:31 UTC (permalink / raw)
  To: Rusty Russell; +Cc: paulus, linux-kernel


> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] One-liner typo 2.5.3-pre3 in ppc/kernel/idle.c
  2002-01-23  5:31 ` Anton Blanchard
@ 2002-01-23  6:00   ` Rusty Russell
  0 siblings, 0 replies; 3+ messages in thread
From: Rusty Russell @ 2002-01-23  6:00 UTC (permalink / raw)
  To: Anton Blanchard; +Cc: paulus, linux-kernel

In message <20020123053118.GB14366@krispykreme> you write:
> 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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-01-23  6:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-01-23  4:41 [PATCH] One-liner typo 2.5.3-pre3 in ppc/kernel/idle.c Rusty Russell
2002-01-23  5:31 ` Anton Blanchard
2002-01-23  6:00   ` Rusty Russell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.