| From | Andrea Arcangeli <> | Subject | [PATCH 17/36] autonuma: prevent select_task_rq_fair to return -1 | Date | Wed, 22 Aug 2012 16:59:01 +0200 |
| |
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 <aarcange@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 */
|