Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp407258pxf; Wed, 7 Apr 2021 02:27:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9gayqMzm09X4BdV12G9NiiO8qMcPqCTcVpRxlEIw+z9dt9rmCCQ1YJc6JDKUFaQesn6CR X-Received: by 2002:a50:b286:: with SMTP id p6mr3346753edd.282.1617787661730; Wed, 07 Apr 2021 02:27:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617787661; cv=none; d=google.com; s=arc-20160816; b=hZStK2ec3Bl+FiWmSXWFv4+Sx9u6d5ZWf9c761FNOnpWu8oeYibdbqoixP29O8R/Pe x5SSKmJUmjJTMYu61wUZXg0RBXw73dnfQo220Him4LZ1BIMSQgV8Tu9XPw7IWPqWBnZu 6oTJhnU7EffHJpSmSy/3bjruxcKkKv4HXdkLWi1N3OpZgjiEPj+IiNY44oi+RLHhRYN2 L/Yh8vJ+nZgWaQPBbygHBzQ78Kxqrue3ubDjkg/bnt7iGVyMirzaBrRu5rDKiiPgNZ+9 sT2uURvGFxUQK6UVwERtNdx6WPfOqUIzlDwrrzeyGw1WsHOYpcpDR4tWTXvpYXGuHPYY D+YQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:date:cc:to:from:subject:message-id; bh=YnKJvjMy6IsO4AoPPuVGOkvQWuQVy8JlxAkW1JcE0xM=; b=wz0jRlNbtcxKBhS9ikvvTg5AuLxISFugPH3wxMvzajUNFERkVTtoYaow2ikZfOfGzE w6JGUZUf2UliTnlSKv1zzJ57gVVzFfCCNordNsznh9GP7nVjX4w1IYngbQD9LZ3bMgrs 0VcEPP9asM59GX6hhyouAKBY3oovQiP1yEhbqoyeOeykJeUCpQSQxjweGOGPCl0+cn6d Q/kw0mo6YvDIBomtDOXSpwAxc/xQk+Czv5uQr+jFdlRdIl0D2k5g3yYH4mswtyu/Gqkw 7B53lpVZJI+2xzowCU6NS6p2hnoEKVPe7+UEaDyKY740CeaXF/s6Gu/2zmvdfL4qDSxk DW8Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j3si18863137eds.542.2021.04.07.02.27.18; Wed, 07 Apr 2021 02:27:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346079AbhDFPzT (ORCPT + 99 others); Tue, 6 Apr 2021 11:55:19 -0400 Received: from shelob.surriel.com ([96.67.55.147]:32994 "EHLO shelob.surriel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346071AbhDFPzP (ORCPT ); Tue, 6 Apr 2021 11:55:15 -0400 Received: from imladris.surriel.com ([96.67.55.152]) by shelob.surriel.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1lTo2i-0004dy-In; Tue, 06 Apr 2021 11:55:04 -0400 Message-ID: <300f7c0dac300e2c3a8dc7f57fd0a834383152ff.camel@surriel.com> Subject: Re: [PATCH v3] sched/fair: bring back select_idle_smt, but differently From: Rik van Riel To: Vincent Guittot Cc: Mel Gorman , linux-kernel , Kernel Team , "Peter Zijlstra (Intel)" , Ingo Molnar , Valentin Schneider Date: Tue, 06 Apr 2021 11:55:04 -0400 In-Reply-To: References: <20210321150358.71ef52b1@imladris.surriel.com> <20210322110306.GE3697@techsingularity.net> <20210326151932.2c187840@imladris.surriel.com> <1e21aa6ea7de3eae32b29559926d4f0ba5fea130.camel@surriel.com> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-NYV5dbC0D0m5tD/Dk91k" User-Agent: Evolution 3.34.4 (3.34.4-1.fc31) MIME-Version: 1.0 Sender: riel@shelob.surriel.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-NYV5dbC0D0m5tD/Dk91k Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, 2021-04-06 at 17:31 +0200, Vincent Guittot wrote: > On Tue, 6 Apr 2021 at 17:26, Rik van Riel wrote: > > On Tue, 2021-04-06 at 17:10 +0200, Vincent Guittot wrote: > > > On Fri, 26 Mar 2021 at 20:19, Rik van Riel > > > wrote: > > >=20 > > > > -static int select_idle_cpu(struct task_struct *p, struct > > > > sched_domain *sd, int target) > > > > +static int select_idle_cpu(struct task_struct *p, struct > > > > sched_domain *sd, int prev, int target) > > > > { > > > > struct cpumask *cpus =3D > > > > this_cpu_cpumask_var_ptr(select_idle_mask); > > > > int i, cpu, idle_cpu =3D -1, nr =3D INT_MAX; > > > > @@ -6136,23 +6163,32 @@ static int select_idle_cpu(struct > > > > task_struct *p, struct sched_domain *sd, int t > > > >=20 > > > > cpumask_and(cpus, sched_domain_span(sd), p->cpus_ptr); > > > >=20 > > > > - if (sched_feat(SIS_PROP) && !smt) { > > > > - u64 avg_cost, avg_idle, span_avg; > > > > + if (!smt) { > > > > + if (cpus_share_cache(prev, target)) { > > >=20 > > > Have you checked the impact on no smt system ? would worth a > > > static > > > branch. > > >=20 > > > Also, this doesn't need to be in select_idle_cpu() which aims to > > > loop > > > the sched_domain becaus you only compare target and prev. So you > > > can > > > move this call to select_idle_smt() in select_idle_sibling() > >=20 > > After Mel's rewrite, there no longer are calls to > > select_idle_core() or select_idle_smt() in select_idle_sibling(). >=20 > select_idle_smt() had even disappeared that why it was not in > select_idle_sibling >=20 > > Everything got folded into one single loop in select_idle_cpu() >=20 > but this is done completely out of the loop so we don't need to > complify the function with unrelated stuff Not entirely. The call to select_idle_smt() is still conditional on test_idle_cores() returning false. We only look for the other sibling if there is no idle core in the LLC. If there is an idle core, we prefer that. Pulling the select_idle_smt() call out of select_idle_cpu() would mean having to test_idle_cores() twice. --=20 All Rights Reversed. --=-NYV5dbC0D0m5tD/Dk91k Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEKR73pCCtJ5Xj3yADznnekoTE3oMFAmBshFgACgkQznnekoTE 3oNrewf/T4EWCI5gom5mJ6zioL9OD9wLkbJK5aZ1UNWk8v7YK5AZNKzouBFbRoET HalJzBdqOpyeq68f/KPCN+8A2RiEwYXAZGH29IixJ7YKw0kvAvtOc7gYPANpleVp zcO9AeOy/W1zzrTp/jch0jUTrmd4p+pEfvfoo7hBSYko5WWM9K09/ZQ08jcweGC/ rq2kfzjb3LESum/WvCTsWUOF2ogcWoOHF1PxxgoqC71DMYhfmxTJWT5vs/BHKKxu WiS8lHpVb1CQgtXn16k4OJ5x5M589oHdld42Pxf0FcLuKbg222/YylQtIjTkXIUC pyDg1YbRAtiKU1qLdp72mG2vlObinw== =OSDL -----END PGP SIGNATURE----- --=-NYV5dbC0D0m5tD/Dk91k--