]> git.hungrycats.org Git - linux/commitdiff
[PATCH] sched: Look at another CPU's domain
authorAndrew Morton <akpm@osdl.org>
Mon, 10 May 2004 06:29:51 +0000 (23:29 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Mon, 10 May 2004 06:29:51 +0000 (23:29 -0700)
From: Nick Piggin <nickpiggin@yahoo.com.au>

The SMT wake_idle code really wants to look at a non-local CPU's domain in
order to check for idle siblings.

So change the domain attachment code a little bit so we continue to hold a
runqueue's lock while attaching a new domain.  This means the locking rules
have changed to: you may access your own domain without any lock, you must
hold a remote runqueue's lock in order to view its domain.

kernel/sched.c

index 3ba86bfbbbb9c1be32f9dbb6ac35ef6ad53bdaf0..bc4366eae0007760828c23dc23963b3832500f4f 100644 (file)
@@ -3392,18 +3392,18 @@ static int migration_thread(void * data)
                req = list_entry(head->next, migration_req_t, list);
                list_del_init(head->next);
 
-               spin_unlock(&rq->lock);
-
                if (req->type == REQ_MOVE_TASK) {
+                       spin_unlock(&rq->lock);
                        __migrate_task(req->task, req->dest_cpu);
+                       local_irq_enable();
                } else if (req->type == REQ_SET_DOMAIN) {
                        rq->sd = req->sd;
+                       spin_unlock_irq(&rq->lock);
                } else {
+                       spin_unlock_irq(&rq->lock);
                        WARN_ON(1);
                }
 
-               local_irq_enable();
-
                complete(&req->done);
        }
        return 0;