Message ID | 20240130131708.429425-6-alexs@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-44686-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1234738dyb; Tue, 30 Jan 2024 05:58:11 -0800 (PST) X-Google-Smtp-Source: AGHT+IFqOPZ8FkSTSPPyjOgSdWbD06OInSA48DTihwHtCcQPj/GHSTMsVDAvS+aCSJS5Q3RxYOC6 X-Received: by 2002:a05:6358:f485:b0:178:7542:1a58 with SMTP id ku5-20020a056358f48500b0017875421a58mr3951611rwb.7.1706623090742; Tue, 30 Jan 2024 05:58:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706623090; cv=pass; d=google.com; s=arc-20160816; b=EQNqUD6GorOjnxgCdqmMaz1/vdvHV3IA4nACYa+QveUm8G7CVryCRaYTNDNzdVcGCU eY8anHWZPBHTVCqGVqHMyznW27vlEpxx1GdmSVV1dPF0EBtEqMfuUV+/nFuHG6jQtTs1 3eaVV9VQIyfBHt2RGQUTjoCxI9D/ou7rDixTVzmBYgqUEPmLHgmWNp+yV1bq0k0Fa151 VzaaM446ltuVk3Y72CmmOGsb+i7FpJQYSCnWiAuvg4Rl8UWCdRdXBfcXdq+TGrfgJpPT jqPgpvMlOKhd1VbpxQjm9yM2PdT1lbOL4rHZqmL1MAVWO9ZuO0pGWmHJ5Fp09tfRKeNS km1g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=bfF1zBa7nVc7gHEDl12BBpqrow2jXHEF8ijxJ/UB0jQ=; fh=CH0OO+rsEMoKRW5HY96+2DQ466rE9ttKX9bm1c+/3Ro=; b=QgoNVuEy8kiPqeteRhf00YZvIm0HE+AXwSjZnM52hQzgS+CX/U4siL1oM8e1OXzD6Q 1LYcxEKNlxkW/lupg6OXF+hjiGG9W0DHcnYgCaDkPzrFB/8GDfPJiOvDV705Au2Ue8XG QnX5NR+ZDlPVhlC3xdFzttcjbuFNESBrGcJFMgwwK8pNcS/W8M2Hy9p8db82A+cACAvo 8EMNITP+oHsqavN/nRcFbhMZxUST4V330dxctUr3HoWckOq4AsnH1ZoQSATHxCrFF8pC /1JJgizsDkAHhEzHUt+7zUxWNGZStCKwT6U6zTtM4ZzTyHcjpZc10K4vo5JXaT2KnUIc J3Cg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YNrtEUQH; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-44686-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44686-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id h126-20020a636c84000000b005d7bf204e26si7444386pgc.899.2024.01.30.05.58.10 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 05:58:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44686-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YNrtEUQH; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-44686-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44686-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 736B5B296C4 for <ouuuleilei@gmail.com>; Tue, 30 Jan 2024 13:15:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5628D74E25; Tue, 30 Jan 2024 13:14:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YNrtEUQH" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9319F6F073 for <linux-kernel@vger.kernel.org>; Tue, 30 Jan 2024 13:14:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706620473; cv=none; b=Oy4j3Pew2Bwjnpup0swu8dedAJlez0JPp1L2cJchAtnuX2QzSyuP2ooK2YMwoJiCTSC9lrKwEwToUsh/sQWxd0mOTHdSiR9K3iQP+1viC0tlfGF6cHRRqspHbf1mosFKxBVQ0/M6aGm/I6gQSmWw6hjC2DE6HDGm6EgWuNx91qk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706620473; c=relaxed/simple; bh=g+mDwC9FPU+XmcCzxUJ4hYXHnkp5fd/Hyf0d6FKB8Rg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PSeTKEbyZrCtN+I66Hozh+RPKDxwz47m1/AU4hHvzIbhqLq1P0qSOpc0gpw9sThFAbCgiZVAs56+24yUytE81xIK++ogyFAaVMHa/R/bw+GR8we5Vpa01816pYQign2clzl87dKbZYVEtSbtsM2yUP1avZIYxoqcZ2XfkIxi35c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YNrtEUQH; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CF9BC43394; Tue, 30 Jan 2024 13:14:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706620473; bh=g+mDwC9FPU+XmcCzxUJ4hYXHnkp5fd/Hyf0d6FKB8Rg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YNrtEUQHPV4xlePXQ6bNoPbZUy0QY/ygNg91OYFhS3FGt7U8wGld+bVHMvTz9l3LE doiIaK5zw+jr/I8PRnw4XKDB9aVDgs/U2UcYq7aY2WwTrblQyXf1bbL0NTRWDEq35n gdp2a8c0Fjd/8W7n+KYY9LLuYKQLcGRcrd/jCCzPTohOsmUxT1EJS8hyEEpfueRpzR BLDAx6QffUjuSONcVLGKjW4hbeQFiWuBhLlrkAmD72bkqAu4Gin9FPcN0bD4IPNJqg l7vpgDKDOEUfJ/Q88D+Ym1r9C/WJr06Wx2fui6ugjuhMfnqRsvG4U+BRdQQYRYyqug HFuO6TF4MSF2w== From: alexs@kernel.org To: Ingo Molnar <mingo@redhat.com>, Peter Zijlstra <peterz@infradead.org>, Juri Lelli <juri.lelli@redhat.com>, Vincent Guittot <vincent.guittot@linaro.org>, Dietmar Eggemann <dietmar.eggemann@arm.com>, Steven Rostedt <rostedt@goodmis.org>, Ben Segall <bsegall@google.com>, Daniel Bristot de Oliveira <bristot@redhat.com>, Valentin Schneider <vschneid@redhat.com>, linux-kernel@vger.kernel.org, ricardo.neri-calderon@linux.intel.com, sshegde@linux.ibm.com Cc: Alex Shi <alexs@kernel.org> Subject: [PATCH v2 6/6 RFT] sched/fair: change sched asym checking condition Date: Tue, 30 Jan 2024 21:17:08 +0800 Message-ID: <20240130131708.429425-6-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240130131708.429425-1-alexs@kernel.org> References: <20240130131708.429425-1-alexs@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789524014105573786 X-GMAIL-MSGID: 1789524014105573786 |
Series |
[v2,1/6] sched/fair: add SD_CLUSTER in comments
|
|
Commit Message
alexs@kernel.org
Jan. 30, 2024, 1:17 p.m. UTC
From: Alex Shi <alexs@kernel.org> Asym only used on SMT sd, or core sd with ITMT and core idled. !sched_smt_active isn't necessary. Signed-off-by: Alex Shi <alexs@kernel.org> To: Ricardo Neri <ricardo.neri-calderon@linux.intel.com> To: linux-kernel@vger.kernel.org To: Valentin Schneider <vschneid@redhat.com> To: Daniel Bristot de Oliveira <bristot@redhat.com> To: Ben Segall <bsegall@google.com> To: Steven Rostedt <rostedt@goodmis.org> To: Dietmar Eggemann <dietmar.eggemann@arm.com> To: Vincent Guittot <vincent.guittot@linaro.org> To: Juri Lelli <juri.lelli@redhat.com> To: Peter Zijlstra <peterz@infradead.org> To: Ingo Molnar <mingo@redhat.com> --- kernel/sched/fair.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Comments
On Tue, Jan 30, 2024 at 09:17:08PM +0800, alexs@kernel.org wrote: > From: Alex Shi <alexs@kernel.org> > > Asym only used on SMT sd, or core sd with ITMT and core idled. > !sched_smt_active isn't necessary. sched_smt_active() is implemented as a static key. Thus, if SMT is not enabled, we can quickly return without having to check the rest of the conditions, as we should. > > Signed-off-by: Alex Shi <alexs@kernel.org> > To: Ricardo Neri <ricardo.neri-calderon@linux.intel.com> > To: linux-kernel@vger.kernel.org > To: Valentin Schneider <vschneid@redhat.com> > To: Daniel Bristot de Oliveira <bristot@redhat.com> > To: Ben Segall <bsegall@google.com> > To: Steven Rostedt <rostedt@goodmis.org> > To: Dietmar Eggemann <dietmar.eggemann@arm.com> > To: Vincent Guittot <vincent.guittot@linaro.org> > To: Juri Lelli <juri.lelli@redhat.com> > To: Peter Zijlstra <peterz@infradead.org> > To: Ingo Molnar <mingo@redhat.com> > --- > kernel/sched/fair.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index 6680cb39c787..0b7530b93429 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -9744,8 +9744,8 @@ static bool sched_use_asym_prio(struct sched_domain *sd, int cpu) > if (!(sd->flags & SD_ASYM_PACKING)) > return false; > > - return (!sched_smt_active()) || > - (sd->flags & SD_SHARE_CPUCAPACITY) || is_core_idle(cpu); > + return (sd->flags & SD_SHARE_CPUCAPACITY) || > + (is_core_idle(cpu) && test_bit(cpu_core_flags(), (void *)&sd->flags)); cpu_core_flags() can contain more than one flag, AFAICS. Which bit should it check? Moreover, it is implemented differently for each architecture. Also, as stated, in x86 asym_packing is also used in domains other than MC.
On 2/1/24 9:10 AM, Ricardo Neri wrote: > On Tue, Jan 30, 2024 at 09:17:08PM +0800, alexs@kernel.org wrote: >> From: Alex Shi <alexs@kernel.org> >> >> Asym only used on SMT sd, or core sd with ITMT and core idled. >> !sched_smt_active isn't necessary. > > sched_smt_active() is implemented as a static key. Thus, if SMT is not > enabled, we can quickly return without having to check the rest of the > conditions, as we should. Hi Ricardo, Thanks a lot for comments! I will drop this patch in this series. But forgive my stupidity, asym feature is possible when SMT enabled instead of SMT disable. Why no SMT is a condition for asm feature? For this asym feature, I only see the SMT and MC domain use this, correct me if I'm wrong. > >> >> Signed-off-by: Alex Shi <alexs@kernel.org> >> To: Ricardo Neri <ricardo.neri-calderon@linux.intel.com> >> To: linux-kernel@vger.kernel.org >> To: Valentin Schneider <vschneid@redhat.com> >> To: Daniel Bristot de Oliveira <bristot@redhat.com> >> To: Ben Segall <bsegall@google.com> >> To: Steven Rostedt <rostedt@goodmis.org> >> To: Dietmar Eggemann <dietmar.eggemann@arm.com> >> To: Vincent Guittot <vincent.guittot@linaro.org> >> To: Juri Lelli <juri.lelli@redhat.com> >> To: Peter Zijlstra <peterz@infradead.org> >> To: Ingo Molnar <mingo@redhat.com> >> --- >> kernel/sched/fair.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c >> index 6680cb39c787..0b7530b93429 100644 >> --- a/kernel/sched/fair.c >> +++ b/kernel/sched/fair.c >> @@ -9744,8 +9744,8 @@ static bool sched_use_asym_prio(struct sched_domain *sd, int cpu) >> if (!(sd->flags & SD_ASYM_PACKING)) >> return false; >> >> - return (!sched_smt_active()) || >> - (sd->flags & SD_SHARE_CPUCAPACITY) || is_core_idle(cpu); >> + return (sd->flags & SD_SHARE_CPUCAPACITY) || >> + (is_core_idle(cpu) && test_bit(cpu_core_flags(), (void *)&sd->flags)); > > cpu_core_flags() can contain more than one flag, AFAICS. Which bit should > it check? Moreover, it is implemented differently for each architecture. It seems only x86 using the function. But there is still a error which SMT/CLUSTER domain also has this flags bit. $ git grep 'cpu_core_flags(' arch/x86/kernel/smpboot.c: return cpu_core_flags() | x86_sched_itmt_flags(); include/linux/sched/topology.h:static inline int cpu_core_flags(void) > Also, as stated, in x86 asym_packing is also used in domains other than MC. For the feature SD_ASYM_PACKING and SD_ASYM_CPUCAPACITY, for guts of 2 features, is it possible to combine them into one, if we give a little bit more capacity to priority cpus, like 5%? Thanks Alex
On 2/1/24 5:10 PM, kuiliang Shi wrote: > > > On 2/1/24 9:10 AM, Ricardo Neri wrote: >> On Tue, Jan 30, 2024 at 09:17:08PM +0800, alexs@kernel.org wrote: >>> From: Alex Shi <alexs@kernel.org> >>> >>> Asym only used on SMT sd, or core sd with ITMT and core idled. >>> !sched_smt_active isn't necessary. >> >> sched_smt_active() is implemented as a static key. Thus, if SMT is not >> enabled, we can quickly return without having to check the rest of the >> conditions, as we should. > > Hi Ricardo, > > Thanks a lot for comments! I will drop this patch in this series. > > But forgive my stupidity, asym feature is possible when SMT enabled instead of SMT disable. Why no SMT is a condition for asm feature? For this asym feature, I only see the SMT and MC domain use this, correct me if I'm wrong. > on power7 ASYM_PACKING is used to pack at SMT level. On x86, ITMT topology uses ASYM_PACKING to do load balancing instead of using different cpu capacities. Its possible to have it in PKG(earlier referred as DIE) as well. In powerpc recently we did that for shared processor LPAR's. So asym feature is in PKG as well. >> >>>
On Thu, Feb 01, 2024 at 08:49:05PM +0530, Shrikanth Hegde wrote: > > > On 2/1/24 5:10 PM, kuiliang Shi wrote: > > > > > > On 2/1/24 9:10 AM, Ricardo Neri wrote: > >> On Tue, Jan 30, 2024 at 09:17:08PM +0800, alexs@kernel.org wrote: > >>> From: Alex Shi <alexs@kernel.org> > >>> > >>> Asym only used on SMT sd, or core sd with ITMT and core idled. > >>> !sched_smt_active isn't necessary. > >> > >> sched_smt_active() is implemented as a static key. Thus, if SMT is not > >> enabled, we can quickly return without having to check the rest of the > >> conditions, as we should. > > > > Hi Ricardo, > > > > Thanks a lot for comments! I will drop this patch in this series. > > > > But forgive my stupidity, asym feature is possible when SMT enabled instead of SMT disable. Why no SMT is a condition for asm feature? For this asym feature, I only see the SMT and MC domain use this, correct me if I'm wrong. > > > > on power7 ASYM_PACKING is used to pack at SMT level. Indeed, this is why the function returns true if it the sched domain has the SD_SHARE_CPUCAPACITY flag. When SMT is disabled there is no point in doing any check because we will always want to use asym_packing. > > On x86, ITMT topology uses ASYM_PACKING to do load balancing instead of using different cpu capacities. You can look at x86_cluster_flags() and x86_die_flags(). > > Its possible to have it in PKG(earlier referred as DIE) as well. > In powerpc recently we did that for shared processor LPAR's. So asym feature is in PKG as well. > > >> > >>>
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 6680cb39c787..0b7530b93429 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9744,8 +9744,8 @@ static bool sched_use_asym_prio(struct sched_domain *sd, int cpu) if (!(sd->flags & SD_ASYM_PACKING)) return false; - return (!sched_smt_active()) || - (sd->flags & SD_SHARE_CPUCAPACITY) || is_core_idle(cpu); + return (sd->flags & SD_SHARE_CPUCAPACITY) || + (is_core_idle(cpu) && test_bit(cpu_core_flags(), (void *)&sd->flags)); } static inline bool sched_asym(struct sched_domain *sd, int dst_cpu, int src_cpu)