find_idlest_cpu when run up on all domain levels shouldn't normally
return -1. With the introduction of the NUMA affinity check that
should be still true most of the time, but it's not guaranteed if the
NUMA affinity of the task changes very fast. So better not to depend
on timings.

Signed-off-by: Andrea Arcangeli <aarca...@redhat.com>
---
 kernel/sched/fair.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 42a88fa..677b99e 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -2794,6 +2794,17 @@ select_task_rq_fair(struct task_struct *p, int sd_flag, 
int wake_flags)
 unlock:
        rcu_read_unlock();
 
+#ifdef CONFIG_AUTONUMA
+       if (new_cpu < 0)
+               /*
+                * find_idlest_cpu() may return -1 if
+                * task_autonuma_cpu() changes all the time, it's very
+                * unlikely, but we must handle it if it ever happens.
+                */
+               new_cpu = prev_cpu;
+#endif
+       BUG_ON(new_cpu < 0);
+
        return new_cpu;
 }
 #endif /* CONFIG_SMP */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to