Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp1827000rwb; Wed, 26 Jul 2023 20:26:47 -0700 (PDT) X-Google-Smtp-Source: APBJJlE4+rAhgjB6XJOjGbtuZi54kFAD8G/R841kUSaqV32D3MNuBrJQm56h7hlYlHmL75SCwo88 X-Received: by 2002:a05:6a20:3d8b:b0:128:ffb7:dcfe with SMTP id s11-20020a056a203d8b00b00128ffb7dcfemr1666877pzi.1.1690428407024; Wed, 26 Jul 2023 20:26:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690428407; cv=none; d=google.com; s=arc-20160816; b=CGBtowfTgrmsiwKfvi+pfeTylEYAtZ6vpeyMmOmzNmnHd2TwfRfeug++lVXhMeKDM5 rTckeUdJaZKS7MushnG4zOa5U3MVsolZaGaK65xoRoj+oTHCl6Ozd2gR9iTHdDeaVZ8G O+FMjx3ARJJg6OMBX8gbb39Wcs4uFulLuriOW696gvm4q2XFcUU88XWw5UyKWhJ49vLg te0CuGofkKESyz1I3syZCHL29gG6dGzMKaH3p6ZBRaauX23eqDpiVskC5jyu7hbEwFdK aoc2G6mDUIKpZAm/q1jcqXEXIMRAbSchsPI02bvifhV49i2u+brDFlIXZC4OB+3AKrE9 gYQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:date:mime-version :content-transfer-encoding:references:in-reply-to:cc:to:from:subject :message-id:dkim-signature; bh=bQ8g0vUnAnvCoWqu3S1xRSjJS4bZgaUQ4mXDyG/BQt0=; fh=TtxqAhHph2OK0lnw0vDsktdK6hphIP9N62zKN22g+qE=; b=lEEjMJsu+xCCJnp6VZlmDWp+DnLlfRiUvvFPfOn21N9FFZF57LXAkbBTwg+CN+ThPO S6NAtJr5YFg6pzUKnQKOqFV4aqCRERyE7+gZ3jJ8t22bAVQg4OhkRkqeb9KSqQ0QAFai WLF4/f/B+IqShkQYA1LoWg7odZZeOv1GvT5jemhF+2f98VNzO6ore4828B2fUNpqpg7P 3M6L70okBS64GnjGRHaPdhrH3hPosiyu/q3BvFyfUl7886uyWwvj9NIttGU6m9lQkFAA eZzyyb/Uwq5DpBpMsuxPUuvypiSxW/8sgIc41IEWxQJQfDilEjs1/Pwry6K2uTg95EYR osOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=iQXsW0da; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bv190-20020a632ec7000000b0055c8d01ad16si373348pgb.265.2023.07.26.20.26.34; Wed, 26 Jul 2023 20:26:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=iQXsW0da; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231407AbjG0DML (ORCPT + 99 others); Wed, 26 Jul 2023 23:12:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230453AbjG0DMH (ORCPT ); Wed, 26 Jul 2023 23:12:07 -0400 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81F8E2719 for ; Wed, 26 Jul 2023 20:12:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690427524; x=1721963524; h=message-id:subject:from:to:cc:in-reply-to:references: content-transfer-encoding:mime-version:date; bh=gUXQh0L7to9XJTvlI2sRmh/KmnYhINJXjMcWDfXjFfY=; b=iQXsW0dao+PQ1hmnIUz5lBUD40Wh9B4mlJEMb64TRZU5D3cqAuXrRNbE UvBAi6mPgH+PR4NaX3QAb/JG/1BYQlJy5EHc/oFHYDn+WzWhosZAiWe9V c0VSNcZ0kJqiZ1gJIG+0Ef+Wy28kPzqcXY2Q1YjFqWC8S+pdnrTWo4G2c psgGOoB34/At2fCDY8ngf8Xt95GfYSDyo2Ret2ix0gz6kPpGcfH3K7uQr w8yJIkKdvBfckcxhFgOE1/VaK8r+n+Pd1zDAGLLPQJgP+v0lsG+1rmog/ Ct/ImtCl2y1bLaj1+o22HIbAhdcSfzMCCIp6RKjplzwR+vbZwpSWSlnMZ g==; X-IronPort-AV: E=McAfee;i="6600,9927,10783"; a="370865574" X-IronPort-AV: E=Sophos;i="6.01,233,1684825200"; d="scan'208";a="370865574" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jul 2023 20:12:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10783"; a="676944342" X-IronPort-AV: E=Sophos;i="6.01,233,1684825200"; d="scan'208";a="676944342" Received: from misbashe-mobl.gar.corp.intel.com (HELO [10.214.146.193]) ([10.214.146.193]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jul 2023 20:11:52 -0700 Message-ID: <804548a12363479d41dee19bb843002d9e105afd.camel@linux.intel.com> Subject: Re: [PATCH] sched/fair: Add SMT4 group_smt_balance handling From: Tim Chen To: Shrikanth Hegde , peterz@infradead.org Cc: bristot@redhat.com, bsegall@google.com, dietmar.eggemann@arm.com, hdanton@sina.com, ionela.voinescu@arm.com, juri.lelli@redhat.com, len.brown@intel.com, linux-kernel@vger.kernel.org, mgorman@suse.de, naveen.n.rao@linux.vnet.ibm.com, rafael.j.wysocki@intel.com, ravi.v.shankar@intel.com, ricardo.neri@intel.com, rostedt@goodmis.org, srikar@linux.vnet.ibm.com, srinivas.pandruvada@linux.intel.com, v-songbaohua@oppo.com, vincent.guittot@linaro.org, vschneid@redhat.com, x86@kernel.org, yangyicong@hisilicon.com, yu.c.chen@intel.com In-Reply-To: <20230717145823.1531759-1-sshegde@linux.vnet.ibm.com> References: <20230717133718.GJ4253@hirez.programming.kicks-ass.net> <20230717145823.1531759-1-sshegde@linux.vnet.ibm.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Date: Wed, 26 Jul 2023 20:11:18 -0700 User-Agent: Evolution 3.44.4 (3.44.4-2.fc36) X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2023-07-17 at 20:28 +0530, Shrikanth Hegde wrote: > From: Tim Chen >=20 > For SMT4, any group with more than 2 tasks will be marked as > group_smt_balance. Retain the behaviour of group_has_spare by marking > the busiest group as the group which has the least number of idle_cpus. >=20 > Also, handle rounding effect of adding (ncores_local + ncores_busy) > when the local is fully idle and busy group has more than 2 tasks. > Local group should try to pull at least 1 task in this case. >=20 > Originally-by: Tim Chen > Signed-off-by: Tim Chen > Signed-off-by: Shrikanth Hegde > --- > kernel/sched/fair.c | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) >=20 > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index 932e7b78894a..9502013abe33 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -9532,7 +9532,7 @@ static inline long sibling_imbalance(struct lb_env = *env, > imbalance /=3D ncores_local + ncores_busiest; >=20 > /* Take advantage of resource in an empty sched group */ > - if (imbalance =3D=3D 0 && local->sum_nr_running =3D=3D 0 && > + if (imbalance <=3D 1 && local->sum_nr_running =3D=3D 0 && > busiest->sum_nr_running > 1) > imbalance =3D 2; >=20 > @@ -9720,6 +9720,17 @@ static bool update_sd_pick_busiest(struct lb_env *= env, > break; >=20 > case group_smt_balance: > + /* no idle cpus on both groups handled by group_fully_busy below */ > + if (sgs->idle_cpus !=3D 0 || busiest->idle_cpus !=3D 0) { > + if (sgs->idle_cpus > busiest->idle_cpus) > + return false; > + if (sgs->idle_cpus < busiest->idle_cpus) > + return true; > + if (sgs->sum_nr_running <=3D busiest->sum_nr_running) > + return false; > + } > + break; > + > case group_fully_busy: > /* > * Select the fully busy group with highest avg_load. In Thanks for the fix up patch. Acked-by: Tim Chen