Message ID | 20240117085715.2614671-5-alexs@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-28676-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:42cf:b0:101:a8e8:374 with SMTP id q15csp778834dye; Wed, 17 Jan 2024 00:58:37 -0800 (PST) X-Google-Smtp-Source: AGHT+IEXudDJ7BWCxLGoaGsqh38nEkQAeRjByx7FvFUO4SqOIklEMnoUk1Uleiufu+g5rlXiTi+H X-Received: by 2002:a05:6214:2265:b0:680:caa6:9612 with SMTP id gs5-20020a056214226500b00680caa69612mr9956711qvb.111.1705481917426; Wed, 17 Jan 2024 00:58:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705481917; cv=pass; d=google.com; s=arc-20160816; b=PPkfWpUZXFUC44FRK+AhKfGTGdkr5dPwEza87AazgwL34+E2juDdON9MbRI/S1ph4n YpQpVvkMSExLka7478YS2MoAujLcjpwFtTT3b4KUw/Yb5bo6dcUOk/cXg9NFMq4t2q0d iw2B9+1ocxNdq8RJIUvAXWSytb38S9+czn0BhLogWBCFDwwZ3yxQo/07q2Ays1WN/Y3/ 8rbiqci1hQInrpeCaCAGYlrnkcqAZpTAA4e/w59fsdwOSq/zRmz8WRzIPsVkv6YznOlb ltLkzfMFG2xLU6dncjrtA5pBZz7PV9N6Xpa0p/KbKPLEjox1SV0KAXbVXSJjZdwJ3WvA BL6Q== 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=8eaXaN9W+z+RV/+Wvdn/qMOUZFlsDMjbR+i4I7SQbyM=; fh=2ooNcWiF1wbXc4MOpItQ0J3HmpaFWSgX1s64XQR6nBA=; b=zlLGL4ofyb8wep9gp7f262SYt4uOVp9mLLr6qeQmXQT0MtFwqnhI7UzshFH0/cf1VE zp5bzrkytmBIOwMFXjwP4DZenV8UWR5FWs9kXMZ2qqwB/ga1jJwkE2i46VfLHWEAOkt6 z7sVFkHqBA8qgNa0WoIkp+pRRnrptNdoOazr4OusYyQIYhrkrKUWx2z06XxDdG1UrkZX 3Z7rkGCYku1+3jjyCi781GcqzqaoK9O/AYOy+JQPVctiJ9xHB5Gd0hDyGU6SAP3zZFSQ DCDhHO8L3U+u0dnk5i0FAmE8IpTj8b5Fue2+qnXZ8fbGBt2bQfZJJnZBwM2mYGq3g5Rk mAFw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZW3q9q3g; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-28676-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28676-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id z20-20020a0cf014000000b0068179c93457si1179581qvk.350.2024.01.17.00.58.37 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Jan 2024 00:58:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-28676-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZW3q9q3g; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-28676-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28676-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 36BA41C24865 for <ouuuleilei@gmail.com>; Wed, 17 Jan 2024 08:58:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 03F261EA8A; Wed, 17 Jan 2024 08:56:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZW3q9q3g" 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 64C891E896 for <linux-kernel@vger.kernel.org>; Wed, 17 Jan 2024 08:56:11 +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=1705481771; cv=none; b=YF4LAzmCvA8ZcNHMG52drTD9AT/V4jlugn5j3PPSv8/BuGIhJJAfIMOVgtjag0UJp9Qxlb1dH/sPcYZiy/q29l0znThlNG6ZmzPFc7LhWkaICSiG2htjXhqnQkJqvbq8Hw02uZOQZje+99ZVLFi0Z9JViaSLQThU6gG338TX+LQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705481771; c=relaxed/simple; bh=KrafdORBylWfUZyJJ7GTGl+pw7Wfz9BmDb03nqcDl7U=; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID: X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; b=gSTEsXpa0FXSOkVnJVmsptvsOFW+uDsDS7AhVSPuGRN0MmKklwU5tDky9duq+lW0c5O3VF0zDx6atdE80e7BaJo6zexBxoCFCPe2dh5quemvcEUD1zulCnoQXARFScRZEvIY45iNpln+lUbe9Q1bbb4GYI3dBJqk4C4bopIxt4A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ZW3q9q3g; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A774C433A6; Wed, 17 Jan 2024 08:56:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705481770; bh=KrafdORBylWfUZyJJ7GTGl+pw7Wfz9BmDb03nqcDl7U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZW3q9q3g3FVDOfQNzQyNTbYXWYxPM4BmMJwsrIRyGMLhqJX81cvqJA8rzuao26L1r WWOJN1kdq8QpuIwZwSV6F+9ouxFdYmIV7ETzuKWJb0XEfyW9yfHd8+R7/F+Huo2Pb8 qvZMrJr+YGJqDXJTIzHPtcuk+2HM1wIeq/6SUhvqyVJ/8osFSJlaQdI98Sv6p7vvgT RvuXjP/YsimmZlUFglqCQqWzyNPc+/xpxSbBhNz4lkeTEtZCS+IXaS7uu9dtfxZ6iS TVLMT2HwyAPkvTKmpuifYrims9L2gy7ffAAKQLqaqKJ58B4VMIJ7PTCHoazTyKPvtR c7j/SMzXvyYsA== 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>, Mel Gorman <mgorman@suse.de>, Daniel Bristot de Oliveira <bristot@redhat.com>, Valentin Schneider <vschneid@redhat.com>, linux-kernel@vger.kernel.org Cc: Alex Shi <alexs@kernel.org> Subject: [PATCH 5/5] sched/fair: narrow the sched_use_asym_prio checking scenario Date: Wed, 17 Jan 2024 16:57:15 +0800 Message-ID: <20240117085715.2614671-5-alexs@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240117085715.2614671-1-alexs@kernel.org> References: <20240117085715.2614671-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: 1788327406919771078 X-GMAIL-MSGID: 1788327406919771078 |
Series |
[1/5] sched/fair: add SD_CLUSTER in comments
|
|
Commit Message
alexs@kernel.org
Jan. 17, 2024, 8:57 a.m. UTC
From: Alex Shi <alexs@kernel.org> Current function doesn't match it's comments, in fact, core_idle checking is only meaningful with non-SMT. So make the function right. Signed-off-by: Alex Shi <alexs@kernel.org> To: Valentin Schneider <vschneid@redhat.com> To: Vincent Guittot <vincent.guittot@linaro.org> 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 1/17/24 2:27 PM, alexs@kernel.org wrote: > From: Alex Shi <alexs@kernel.org> > > Current function doesn't match it's comments, in fact, core_idle > checking is only meaningful with non-SMT. > So make the function right. > > Signed-off-by: Alex Shi <alexs@kernel.org> > To: Valentin Schneider <vschneid@redhat.com> > To: Vincent Guittot <vincent.guittot@linaro.org> > 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 96163ab69ae0..0a321f639c79 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -9741,8 +9741,8 @@ group_type group_classify(unsigned int imbalance_pct, > */ > static bool sched_use_asym_prio(struct sched_domain *sd, int cpu) > { > - return (!sched_smt_active()) || > - (sd->flags & SD_SHARE_CPUCAPACITY) || is_core_idle(cpu); > + return (sd->flags & SD_SHARE_CPUCAPACITY) || > + (!sched_smt_active() && is_core_idle(cpu)); > } This seems wrong. This would always return false for higher than SMT domains if smt is active. Was this meant to be sched_smt_active() && is_core_idle(cpu)? > > static inline bool _sched_asym(struct sched_domain *sd,
On 1/23/24 4:47 PM, Shrikanth Hegde wrote: > > > On 1/17/24 2:27 PM, alexs@kernel.org wrote: >> From: Alex Shi <alexs@kernel.org> >> >> Current function doesn't match it's comments, in fact, core_idle >> checking is only meaningful with non-SMT. >> So make the function right. >> >> Signed-off-by: Alex Shi <alexs@kernel.org> >> To: Valentin Schneider <vschneid@redhat.com> >> To: Vincent Guittot <vincent.guittot@linaro.org> >> 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 96163ab69ae0..0a321f639c79 100644 >> --- a/kernel/sched/fair.c >> +++ b/kernel/sched/fair.c >> @@ -9741,8 +9741,8 @@ group_type group_classify(unsigned int imbalance_pct, >> */ >> static bool sched_use_asym_prio(struct sched_domain *sd, int cpu) >> { >> - return (!sched_smt_active()) || >> - (sd->flags & SD_SHARE_CPUCAPACITY) || is_core_idle(cpu); >> + return (sd->flags & SD_SHARE_CPUCAPACITY) || >> + (!sched_smt_active() && is_core_idle(cpu)); >> } > > This seems wrong. This would always return false for higher than SMT domains > if smt is active. > yes, thanks for point out. > Was this meant to be sched_smt_active() && is_core_idle(cpu)? In theory, yes, it should like this. But I have no ASYM device to test. :( Thanks! Alex > >> >> static inline bool _sched_asym(struct sched_domain *sd,
On Tue, Jan 23, 2024 at 02:17:00PM +0530, Shrikanth Hegde wrote: > > > On 1/17/24 2:27 PM, alexs@kernel.org wrote: > > From: Alex Shi <alexs@kernel.org> > > > > Current function doesn't match it's comments, in fact, core_idle > > checking is only meaningful with non-SMT. For SMT cores, we _do_ need to check for a whole core to be idle when deciding to use asym_packing priorities when balancing between cores, but not in SMT domains. This is what the function's documentation states. > > So make the function right. > > > > Signed-off-by: Alex Shi <alexs@kernel.org> > > To: Valentin Schneider <vschneid@redhat.com> > > To: Vincent Guittot <vincent.guittot@linaro.org> > > 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 96163ab69ae0..0a321f639c79 100644 > > --- a/kernel/sched/fair.c > > +++ b/kernel/sched/fair.c > > @@ -9741,8 +9741,8 @@ group_type group_classify(unsigned int imbalance_pct, > > */ > > static bool sched_use_asym_prio(struct sched_domain *sd, int cpu) > > { > > - return (!sched_smt_active()) || > > - (sd->flags & SD_SHARE_CPUCAPACITY) || is_core_idle(cpu); > > + return (sd->flags & SD_SHARE_CPUCAPACITY) || > > + (!sched_smt_active() && is_core_idle(cpu)); > > } > > This seems wrong. This would always return false for higher than SMT domains > if smt is active. Agreed. > > Was this meant to be sched_smt_active() && is_core_idle(cpu)? But this would not work if SMT is inactive, in such case checking for a whole idle core is pointless.
On Thu, Jan 25, 2024 at 05:35:32PM +0800, kuiliang Shi wrote: > > > On 1/23/24 4:47 PM, Shrikanth Hegde wrote: > > > > > > On 1/17/24 2:27 PM, alexs@kernel.org wrote: > >> From: Alex Shi <alexs@kernel.org> > >> > >> Current function doesn't match it's comments, in fact, core_idle > >> checking is only meaningful with non-SMT. > >> So make the function right. > >> > >> Signed-off-by: Alex Shi <alexs@kernel.org> > >> To: Valentin Schneider <vschneid@redhat.com> > >> To: Vincent Guittot <vincent.guittot@linaro.org> > >> 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 96163ab69ae0..0a321f639c79 100644 > >> --- a/kernel/sched/fair.c > >> +++ b/kernel/sched/fair.c > >> @@ -9741,8 +9741,8 @@ group_type group_classify(unsigned int imbalance_pct, > >> */ > >> static bool sched_use_asym_prio(struct sched_domain *sd, int cpu) > >> { > >> - return (!sched_smt_active()) || > >> - (sd->flags & SD_SHARE_CPUCAPACITY) || is_core_idle(cpu); > >> + return (sd->flags & SD_SHARE_CPUCAPACITY) || > >> + (!sched_smt_active() && is_core_idle(cpu)); > >> } > > > > This seems wrong. This would always return false for higher than SMT domains > > if smt is active. > > > > yes, thanks for point out. > > > Was this meant to be sched_smt_active() && is_core_idle(cpu)? > > In theory, yes, it should like this. But I have no ASYM device to test. :( This would not work with !SMT and asym_packing. I can test your patches on asym_packing + SMT systems if you post a new version.
On 1/26/24 8:06 AM, Ricardo Neri wrote: > On Thu, Jan 25, 2024 at 05:35:32PM +0800, kuiliang Shi wrote: >> >> >> On 1/23/24 4:47 PM, Shrikanth Hegde wrote: >>> >>> >>> On 1/17/24 2:27 PM, alexs@kernel.org wrote: >>>> From: Alex Shi <alexs@kernel.org> >>>> >>>> Current function doesn't match it's comments, in fact, core_idle >>>> checking is only meaningful with non-SMT. >>>> So make the function right. >>>> >>>> Signed-off-by: Alex Shi <alexs@kernel.org> >>>> To: Valentin Schneider <vschneid@redhat.com> >>>> To: Vincent Guittot <vincent.guittot@linaro.org> >>>> 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 96163ab69ae0..0a321f639c79 100644 >>>> --- a/kernel/sched/fair.c >>>> +++ b/kernel/sched/fair.c >>>> @@ -9741,8 +9741,8 @@ group_type group_classify(unsigned int imbalance_pct, >>>> */ >>>> static bool sched_use_asym_prio(struct sched_domain *sd, int cpu) >>>> { >>>> - return (!sched_smt_active()) || >>>> - (sd->flags & SD_SHARE_CPUCAPACITY) || is_core_idle(cpu); >>>> + return (sd->flags & SD_SHARE_CPUCAPACITY) || >>>> + (!sched_smt_active() && is_core_idle(cpu)); >>>> } >>> >>> This seems wrong. This would always return false for higher than SMT domains >>> if smt is active. >>> >> >> yes, thanks for point out. >> >>> Was this meant to be sched_smt_active() && is_core_idle(cpu)? >> >> In theory, yes, it should like this. But I have no ASYM device to test. :( > > This would not work with !SMT and asym_packing. > > I can test your patches on asym_packing + SMT systems if you post a new > version. > Hi Neri, Thanks a lot for generous offer! I don't know if my understanding right, but I try my best to have a best guessing in V2 patch for you. :) Many thanks for the help! Best regards Alex
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 96163ab69ae0..0a321f639c79 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9741,8 +9741,8 @@ group_type group_classify(unsigned int imbalance_pct, */ static bool sched_use_asym_prio(struct sched_domain *sd, int cpu) { - return (!sched_smt_active()) || - (sd->flags & SD_SHARE_CPUCAPACITY) || is_core_idle(cpu); + return (sd->flags & SD_SHARE_CPUCAPACITY) || + (!sched_smt_active() && is_core_idle(cpu)); } static inline bool _sched_asym(struct sched_domain *sd,