Messages in this thread Patch in this message | | | Date | Thu, 22 Apr 2004 00:03:08 -0700 | From | Andrew Morton <> | Subject | Re: CPU Hotplug broken -mm5 onwards |
| |
Srivatsa Vaddagiri <vatsa@in.ibm.com> wrote: > > Anyway patch below addresses the above races. Its against 2.6.6-rc2-mm1 > and has been tested on a 4way Intel Pentium SMP m/c. I have added a > cpu_is_offlince check in migration_thread(). If that is true, migration > thread stop processing and just waits for kthread_stop.
I'll take the stunned silence as agreement ;)
It needed a warning fixup:
kernel/sched.c: In function `migration_call': kernel/sched.c:3648: warning: unused variable `tmp' kernel/sched.c:3648: warning: unused variable `req' kernel/sched.c:3647: warning: unused variable `head'
---
25-akpm/kernel/sched.c | 44 ++++++++++++++++++++++++-------------------- 1 files changed, 24 insertions(+), 20 deletions(-)
diff -puN kernel/sched.c~sched-remove_hotplug_lock_in_sched_migrate_task-warnings kernel/sched.c --- 25/kernel/sched.c~sched-remove_hotplug_lock_in_sched_migrate_task-warnings 2004-04-21 23:56:43.736745848 -0700 +++ 25-akpm/kernel/sched.c 2004-04-21 23:58:42.628671528 -0700 @@ -3339,8 +3339,6 @@ static int migration_call(struct notifie struct task_struct *p; struct runqueue *rq; unsigned long flags; - struct list_head *head; - migration_req_t *req, *tmp; switch (action) { case CPU_UP_PREPARE: @@ -3363,25 +3361,31 @@ static int migration_call(struct notifie /* Unbind it from offline cpu so it can run. Fall thru. */ kthread_bind(cpu_rq(cpu)->migration_thread,smp_processor_id()); case CPU_DEAD: - rq = cpu_rq(cpu); - head = &rq->migration_queue; - spin_lock_irq(&rq->lock); - list_for_each_entry_safe(req, tmp, head, list) { - - BUG_ON(req->type != REQ_MOVE_TASK); - - list_del_init(&req->list); - - /* No need to migrate the task in the request. It would - * have already been migrated (maybe to a different - * CPU). Just wake up the requestor. - */ - complete(&req->done); + { + struct list_head *head; + migration_req_t *req, *tmp; + + rq = cpu_rq(cpu); + head = &rq->migration_queue; + spin_lock_irq(&rq->lock); + list_for_each_entry_safe(req, tmp, head, list) { + + BUG_ON(req->type != REQ_MOVE_TASK); + + list_del_init(&req->list); + + /* + * No need to migrate the task in the request. + * It would have already been migrated (maybe to + * a different CPU). Just wake up the requestor + */ + complete(&req->done); + } + spin_unlock_irq(&rq->lock); + kthread_stop(cpu_rq(cpu)->migration_thread); + cpu_rq(cpu)->migration_thread = NULL; + BUG_ON(cpu_rq(cpu)->nr_running != 0); } - spin_unlock_irq(&rq->lock); - kthread_stop(cpu_rq(cpu)->migration_thread); - cpu_rq(cpu)->migration_thread = NULL; - BUG_ON(cpu_rq(cpu)->nr_running != 0); break; #endif } _
- 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/
| |