From fea42b1b155e7c88cb78d6f4c1af2d31d8f927b9 Mon Sep 17 00:00:00 2001 From: Kirill Korotaev Date: Sun, 10 Dec 2006 02:20:11 -0800 Subject: [PATCH] --- yaml --- r: 43978 b: refs/heads/master c: 054b9108e01ef27e2e6b32b4226abb6024626f06 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/kernel/sched.c | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index 03cac5c0e435..ce4568759856 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 6711cab43ed5e60bf51e3dbbce6395e87d4e9805 +refs/heads/master: 054b9108e01ef27e2e6b32b4226abb6024626f06 diff --git a/trunk/kernel/sched.c b/trunk/kernel/sched.c index a08387b5f7fa..f04add905bdf 100644 --- a/trunk/kernel/sched.c +++ b/trunk/kernel/sched.c @@ -1952,6 +1952,7 @@ static void double_rq_lock(struct rq *rq1, struct rq *rq2) __acquires(rq1->lock) __acquires(rq2->lock) { + BUG_ON(!irqs_disabled()); if (rq1 == rq2) { spin_lock(&rq1->lock); __acquire(rq2->lock); /* Fake it out ;) */ @@ -1991,6 +1992,11 @@ static void double_lock_balance(struct rq *this_rq, struct rq *busiest) __acquires(busiest->lock) __acquires(this_rq->lock) { + if (unlikely(!irqs_disabled())) { + /* printk() doesn't work good under rq->lock */ + spin_unlock(&this_rq->lock); + BUG_ON(1); + } if (unlikely(!spin_trylock(&busiest->lock))) { if (busiest < this_rq) { spin_unlock(&this_rq->lock); @@ -5067,7 +5073,10 @@ static int migration_thread(void *data) } #ifdef CONFIG_HOTPLUG_CPU -/* Figure out where task on dead CPU should go, use force if neccessary. */ +/* + * Figure out where task on dead CPU should go, use force if neccessary. + * NOTE: interrupts should be disabled by the caller + */ static void move_task_off_dead_cpu(int dead_cpu, struct task_struct *p) { unsigned long flags; @@ -5187,6 +5196,7 @@ void idle_task_exit(void) mmdrop(mm); } +/* called under rq->lock with disabled interrupts */ static void migrate_dead(unsigned int dead_cpu, struct task_struct *p) { struct rq *rq = cpu_rq(dead_cpu); @@ -5203,10 +5213,11 @@ static void migrate_dead(unsigned int dead_cpu, struct task_struct *p) * Drop lock around migration; if someone else moves it, * that's OK. No task can be added to this CPU, so iteration is * fine. + * NOTE: interrupts should be left disabled --dev@ */ - spin_unlock_irq(&rq->lock); + spin_unlock(&rq->lock); move_task_off_dead_cpu(dead_cpu, p); - spin_lock_irq(&rq->lock); + spin_lock(&rq->lock); put_task_struct(p); }