public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Bug in sys_sched_yield
@ 2001-04-11 19:31 Hubertus Franke
  2001-04-11 20:12 ` Andrea Arcangeli
  2001-04-12 16:08 ` [Lse-tech] " george anzinger
  0 siblings, 2 replies; 6+ messages in thread
From: Hubertus Franke @ 2001-04-11 19:31 UTC (permalink / raw)
  To: mingo; +Cc: Linux Kernel List, lse-tech



In the recent optimizations to sys_sched_yield a bug was introduced.
In the current implementation of sys_sched_yield()
the aligned_data and idle_tasks are indexed by logical cpu-#.

They should however be indexed by physical cpu-#.
Since logical==physical on the x86 platform, it doesn't matter there,
for other platforms where this is not true it will matter.
Below is the fix.


diff -uwrbBN linux-2.4.3/kernel/sched.c linux-2.4.3-fix/kernel/sched.c
--- linux-2.4.3/kernel/sched.c     Thu Mar 22 12:20:45 2001
+++ linux-2.4.3-fix/kernel/sched.c Wed Apr 11 11:27:16 2001
@@ -1024,9 +1024,11 @@
     int i;

     // Substract non-idle processes running on other CPUs.
-    for (i = 0; i < smp_num_cpus; i++)
-         if (aligned_data[i].schedule_data.curr != idle_task(i))
+    for (i = 0; i < smp_num_cpus; i++) {
+         int cpu = cpu_logical_map(i);
+         if (aligned_data[cpu].schedule_data.curr != idle_task(cpu))
               nr_pending--;
+    }
 #else
     // on UP this process is on the runqueue as well
     nr_pending--;

Hubertus Franke
Enterprise Linux Group (Mgr),  Linux Technology Center (Member Scalability)

email: frankeh@us.ibm.com
(w) 914-945-2003    (fax) 914-945-4425   TL: 862-2003





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

end of thread, other threads:[~2001-04-16 16:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-04-11 19:31 Bug in sys_sched_yield Hubertus Franke
2001-04-11 20:12 ` Andrea Arcangeli
2001-04-12 16:08 ` [Lse-tech] " george anzinger
2001-04-12 16:49   ` Walt Drummond
2001-04-12 17:31     ` george anzinger
2001-04-16 16:03       ` Walt Drummond

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox