From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 023F1C4361A for ; Thu, 3 Dec 2020 17:52:09 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 844F5206D8 for ; Thu, 3 Dec 2020 17:52:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 844F5206D8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=techsingularity.net Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=Un/yrvLKr423jbU4K0xqOPv7quzphr/59BntWtUixuk=; b=G1duIggDZqH01Y0RyBnAXir7/ 2jSWEt9HT9+Y66HCgbFYXllkRizp0OXOQIstC6CjhutkfkEZ4yyT38AI+p2xGRufbf5j7j+dP+uGN bUmpCNL3IGUw0HsI1w76cnBKQB74vEkUQxt5o2ighuBTqJ4FkhsNwAEqrBcXaAAvN7Xr0CxXxUUn/ V9xaJP7XlsG1VVIczF7vqDtMQzqaHq1OGI3VA9Utbf3SkmVeLYf+gyaHhj7I9Gvh1lUiXTd7Rb7ga qMoqk5RvmXkXm/zxk2JfHBJ6+zVMXe/V8RCJMchketAmk7WKnjeaUbvR1ZKCY9ivyzlYlA8rnlKNx 7dTerLmQw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kkske-0006nn-Lw; Thu, 03 Dec 2020 17:50:44 +0000 Received: from outbound-smtp53.blacknight.com ([46.22.136.237]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kkskb-0006mk-Nv for linux-arm-kernel@lists.infradead.org; Thu, 03 Dec 2020 17:50:43 +0000 Received: from mail.blacknight.com (pemlinmail05.blacknight.ie [81.17.254.26]) by outbound-smtp53.blacknight.com (Postfix) with ESMTPS id F1557FA967 for ; Thu, 3 Dec 2020 17:50:35 +0000 (GMT) Received: (qmail 7026 invoked from network); 3 Dec 2020 17:50:35 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.22.4]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 3 Dec 2020 17:50:35 -0000 Date: Thu, 3 Dec 2020 17:50:34 +0000 From: Mel Gorman To: Vincent Guittot Subject: Re: [PATCH 04/10] sched/fair: Return an idle cpu if one is found after a failed search for an idle core Message-ID: <20201203175034.GX3371@techsingularity.net> References: <20201203141124.7391-1-mgorman@techsingularity.net> <20201203141124.7391-5-mgorman@techsingularity.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201203_125041_908892_9E100307 X-CRM114-Status: GOOD ( 22.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Barry Song , Juri Lelli , Peter Ziljstra , Aubrey Li , LKML , Ingo Molnar , Valentin Schneider , Linux-ARM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Dec 03, 2020 at 05:35:29PM +0100, Vincent Guittot wrote: > > index fc48cc99b03d..845bc0cd9158 100644 > > --- a/kernel/sched/fair.c > > +++ b/kernel/sched/fair.c > > @@ -6066,6 +6066,7 @@ void __update_idle_core(struct rq *rq) > > */ > > static int select_idle_core(struct task_struct *p, struct sched_domain *sd, int target) > > { > > + int idle_candidate = -1; > > struct cpumask *cpus = this_cpu_cpumask_var_ptr(select_idle_mask); > > int core, cpu; > > > > @@ -6084,7 +6085,13 @@ static int select_idle_core(struct task_struct *p, struct sched_domain *sd, int > > schedstat_inc(this_rq()->sis_scanned); > > if (!available_idle_cpu(cpu)) { > > idle = false; > > - break; > > + if (idle_candidate != -1) > > + break; > > > If I get your changes correctly, it will now continue to loop on all > cpus of the smt mask to try to find an idle cpu whereas it was That was an oversight, the intent is that the SMT search breaks but the search for an idle core continues. The patch was taken from a very different series that unified all the select_idle_* functions as a single function and I failed to fix it up properly. The unification series didn't generate good results back 9 months ago when I tried and I never finished it off. In the current context, it would not make sense to try a unification again. > With the change above you might end up looping all cpus of llc if > there is only one idle cpu in the llc whereas before we were looping > only 1 cpu per core at most. The bottom change makes sense but the > above on is in some way replacing completely select_idle_cpu and > bypass SIS_PROP and we should avoid that IMO > You're right of course, it was never intended to behave like that. diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 0a3d338770c4..49b1590e60a9 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6084,8 +6084,7 @@ static int select_idle_core(struct task_struct *p, struct sched_domain *sd, int for_each_cpu(cpu, cpu_smt_mask(core)) { if (!available_idle_cpu(cpu)) { idle = false; - if (idle_candidate != -1) - break; + break; } if (idle_candidate == -1 && -- Mel Gorman SUSE Labs _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel