[BK PATCH 2.5.6-pre2] fix task migration code boot hang

James Bottomley (James.Bottomley@steeleye.com)
Wed, 27 Feb 2002 15:17:12 -0600


This is a multipart MIME message.

--==_Exmh_12086244520
Content-Type: text/plain; charset=us-ascii

The task migration code of change set 1.373 actually only works on
architectures where the physical and logical CPU numberings are the same. It
they aren't, the boot sequence hangs forever. The attached fixes the code to
work on all architectures.

James Bottomley

--==_Exmh_12086244520
Content-Type: text/plain ; name="migrate.diff"; charset=us-ascii
Content-Description: migrate.diff
Content-Disposition: attachment; filename="migrate.diff"

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
# ChangeSet 1.425 -> 1.426
# kernel/sched.c 1.51 -> 1.52
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/02/27 jejb@malley.hansenpartnership.com 1.426
# Fix new SMP migration thread code (introduced in change set 1.373)
#
# - make migration_mask a logical bitmap with correct conversions.
# --------------------------------------------
#
diff -Nru a/kernel/sched.c b/kernel/sched.c
--- a/kernel/sched.c Wed Feb 27 15:04:46 2002
+++ b/kernel/sched.c Wed Feb 27 15:04:46 2002
@@ -1555,7 +1555,8 @@
down(&req.sem);
}

-static volatile unsigned long migration_mask;
+/* NOTE: migration_mask is a bitmap of logical CPUs */
+static volatile unsigned long migration_mask = 0;

static int migration_thread(void * unused)
{
@@ -1585,7 +1586,8 @@

for (;;) {
preempt_disable();
- if (test_and_clear_bit(smp_processor_id(), &migration_mask))
+ if (test_and_clear_bit(cpu_number_map(smp_processor_id()),
+ &migration_mask))
current->cpus_allowed = 1 << smp_processor_id();
if (test_thread_flag(TIF_NEED_RESCHED))
schedule();
@@ -1656,7 +1658,7 @@
migration_mask = (1 << smp_num_cpus) - 1;

for (cpu = 0; cpu < smp_num_cpus; cpu++)
- while (!cpu_rq(cpu)->migration_thread)
+ while (!cpu_rq(cpu_logical_map(cpu))->migration_thread)
schedule_timeout(2);
if (migration_mask)
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W3
M:0Z"?=GE./BI@[:?>H;K@GH*N@_#X;,;H--W+;SY-R&Y\RNW;>9K*5?K9)6P
)SZ-TOJZW!@``
`
end

--==_Exmh_12086244520--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/