]> git.hungrycats.org Git - linux/commitdiff
- sync wakeup affinity fix: do not fast-migrate threads
authorIngo Molnar <mingo@elte.hu>
Tue, 18 Jun 2002 19:30:49 +0000 (21:30 +0200)
committerIngo Molnar <mingo@elte.hu>
Tue, 18 Jun 2002 19:30:49 +0000 (21:30 +0200)
  without making sure that the target CPU is allowed.

kernel/sched.c

index 97894be46107ba35ec9e5c57958b4b23e83fa81e..4436e028db04093e0ecb1b3e76aa05814edfd4ff 100644 (file)
@@ -361,12 +361,17 @@ repeat_lock_task:
        rq = task_rq_lock(p, &flags);
        old_state = p->state;
        if (!p->array) {
-               if (unlikely(sync && (rq->curr != p))) {
-                       if (p->thread_info->cpu != smp_processor_id()) {
-                               p->thread_info->cpu = smp_processor_id();
-                               task_rq_unlock(rq, &flags);
-                               goto repeat_lock_task;
-                       }
+               /*
+                * Fast-migrate the task if it's not running or runnable
+                * currently. Do not violate hard affinity.
+                */
+               if (unlikely(sync && (rq->curr != p) &&
+                       (p->thread_info->cpu != smp_processor_id()) &&
+                       (p->cpus_allowed & (1UL << smp_processor_id())))) {
+
+                       p->thread_info->cpu = smp_processor_id();
+                       task_rq_unlock(rq, &flags);
+                       goto repeat_lock_task;
                }
                if (old_state == TASK_UNINTERRUPTIBLE)
                        rq->nr_uninterruptible--;