Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751286AbbFLFfP (ORCPT ); Fri, 12 Jun 2015 01:35:15 -0400 Received: from mail-wi0-f171.google.com ([209.85.212.171]:37908 "EHLO mail-wi0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751095AbbFLFfI (ORCPT ); Fri, 12 Jun 2015 01:35:08 -0400 Message-ID: <1434087305.3674.26.camel@gmail.com> Subject: Re: [PATCH RESEND] sched: prefer an idle cpu vs an idle sibling for BALANCE_WAKE From: Mike Galbraith To: Peter Zijlstra Cc: Josef Bacik , riel@redhat.com, mingo@redhat.com, linux-kernel@vger.kernel.org, morten.rasmussen@arm.com Date: Fri, 12 Jun 2015 07:35:05 +0200 In-Reply-To: <20150528110514.GR18673@twins.programming.kicks-ass.net> References: <1432761736-22093-1-git-send-email-jbacik@fb.com> <20150528102127.GD3644@twins.programming.kicks-ass.net> <20150528110514.GR18673@twins.programming.kicks-ass.net> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.11 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1687 Lines: 56 On Thu, 2015-05-28 at 13:05 +0200, Peter Zijlstra wrote: > @@ -5022,22 +5026,28 @@ select_task_rq_fair(struct task_struct *p, int prev_cpu, int sd_flag, int wake_f > * If both cpu and prev_cpu are part of this domain, > * cpu is a valid SD_WAKE_AFFINE target. > */ > - if (want_affine && (tmp->flags & SD_WAKE_AFFINE) && > - cpumask_test_cpu(prev_cpu, sched_domain_span(tmp))) { > + if (want_affine && !affine_sd && > + (tmp->flags & SD_WAKE_AFFINE) && > + cpumask_test_cpu(prev_cpu, sched_domain_span(tmp))) > affine_sd = tmp; > - break; > - } > > if (tmp->flags & sd_flag) > sd = tmp; > + else if (!want_affine || (want_affine && affine_sd)) > + break; > } Hm, new_cpu == cpu. > - if (affine_sd && cpu != prev_cpu && wake_affine(affine_sd, p, sync)) > + if (affine_sd && cpu != prev_cpu && wake_affine(affine_sd, p, sync)) { > prev_cpu = cpu; > + sd = NULL; /* WAKE_AFFINE trumps BALANCE_WAKE */ > + } If branch above is not taken, new_cpu remains cpu. > if (sd_flag & SD_BALANCE_WAKE) { > - new_cpu = select_idle_sibling(p, prev_cpu); > - goto unlock; > + int tmp = select_idle_sibling(p, prev_cpu); > + if (tmp >= 0) { > + new_cpu = tmp; > + goto unlock; > + } > } If select_idle_sibling() returns -1, new_cpu remains cpu. > > while (sd) { If sd == NULL, we fall through and try to pull wakee despite nacked-by tsk_cpus_allowed() or wake_affine(). -Mike -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/