Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757487AbbFQSHD (ORCPT ); Wed, 17 Jun 2015 14:07:03 -0400 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:53809 "EHLO mx0b-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752373AbbFQSG5 (ORCPT ); Wed, 17 Jun 2015 14:06:57 -0400 Message-ID: <5581B70D.2000800@fb.com> Date: Wed, 17 Jun 2015 11:06:05 -0700 From: Josef Bacik User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Mike Galbraith , Peter Zijlstra CC: , , , Subject: Re: [PATCH RESEND] sched: prefer an idle cpu vs an idle sibling for BALANCE_WAKE References: <1432761736-22093-1-git-send-email-jbacik@fb.com> <20150528102127.GD3644@twins.programming.kicks-ass.net> <20150528110514.GR18673@twins.programming.kicks-ass.net> <1434087305.3674.26.camel@gmail.com> In-Reply-To: <1434087305.3674.26.camel@gmail.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [192.168.52.123] X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.14.151,1.0.33,0.0.0000 definitions=2015-06-17_07:2015-06-16,2015-06-17,1970-01-01 signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2067 Lines: 71 On 06/11/2015 10:35 PM, Mike Galbraith wrote: > 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(). > So maybe add a check in the if (sd_flag & SD_BALANCE_WAKE) for something like this if (tmp >= 0) { new_cpu = tmp; goto unlock; } else if (!want_affine) { new_cpu = prev_cpu; } so we can make sure we're not being pushed onto a cpu that we aren't allowed on? Thanks, Josef -- 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/