From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx161.postini.com [74.125.245.161]) by kanga.kvack.org (Postfix) with SMTP id CA32D6B00E3 for ; Wed, 3 Oct 2012 19:52:35 -0400 (EDT) From: Andrea Arcangeli Subject: [PATCH 17/33] autonuma: prevent select_task_rq_fair to return -1 Date: Thu, 4 Oct 2012 01:50:59 +0200 Message-Id: <1349308275-2174-18-git-send-email-aarcange@redhat.com> In-Reply-To: <1349308275-2174-1-git-send-email-aarcange@redhat.com> References: <1349308275-2174-1-git-send-email-aarcange@redhat.com> Sender: owner-linux-mm@kvack.org List-ID: To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Linus Torvalds , Andrew Morton , Peter Zijlstra , Ingo Molnar , Mel Gorman , Hugh Dickins , Rik van Riel , Johannes Weiner , Hillf Danton , Andrew Jones , Dan Smith , Thomas Gleixner , Paul Turner , Christoph Lameter , Suresh Siddha , Mike Galbraith , "Paul E. McKenney" , Lai Jiangshan , Bharata B Rao , Lee Schermerhorn , Srivatsa Vaddagiri , Alex Shi , Mauricio Faria de Oliveira , Konrad Rzeszutek Wilk , Don Morris , Benjamin Herrenschmidt 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 --- 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 877f077..0c6bedd 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -2808,6 +2808,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, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org