Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp3106895rwp; Fri, 14 Jul 2023 17:52:15 -0700 (PDT) X-Google-Smtp-Source: APBJJlFZJ2la/bmpgokldjY+9dhcZdN499QKfjYSAI+lZnAnXf8OlQLSu/fkAopzX2VBJq1uFRF5 X-Received: by 2002:a17:90b:46d1:b0:263:a5b5:c538 with SMTP id jx17-20020a17090b46d100b00263a5b5c538mr5805096pjb.4.1689382334854; Fri, 14 Jul 2023 17:52:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689382334; cv=none; d=google.com; s=arc-20160816; b=Q9fIGyo00+R9DQMCwA0Si+YcLLM3IBEnz4PKSVKvA7AxVmGQnkI1tNyWHjtD8eudbR ummpwk5BkCnhuW5l/8sqILbNrwHEknI2TPRhCGyQMOo7AIB8MjBgboTvngFVhVvE/RD6 L0F7CQRuW7ubxh/DKcxIUV/m9WPp0wRC1F1Q+PwOIkdx4TWd3ff2qN+RHsjj6cc3bPis tfQqTHs44rdZji5FmdTONbjkn/kQL29Pl+vQRyF84aleNuldbI3TOc/OCLBsupZ51ess aB3cuusuEtTdd2gdRy5MvjpSkMD6O9DzFpjyI1jLaohZDVDJgEr2wnekBx6SiS/BVZ5l ODCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id:dkim-signature; bh=Bl7NLqPb/3pfwF8PPNadXdK5ROifdVPcz5A8WoIGUww=; fh=LW5NgDSF1Zod7TklUpQLiaXcoOpo1UDla+ETXfdrY5c=; b=R8NJ+SYIv4SZKkD00uhW6P4QpO+VqPLuKPru0NsMt6YsOuBrigAUH9IdNX0LCS8Z4q kztUqDadUEW+BLKnh2asQEha7CZG93QXWwmAm+K6VX6GEeiZU9dn6Xft15QOB9B86gl6 W6WDnK9SmAMDRgo/xo1sYIHsDQCQbKoafIMk4vJdEMDg3Mk4KVK3NXsyLfFeWWEWVkMH sLR46uzyUXTDGwA9/qpW/JvZ/AWy88cYkV99bqWuiA/nFcHnTmWELVFGTyyM/k8IhEyH 2dEp2DPpqbqDyRP/leshpYY7SMLNDDQnBtcAdrzNpMqgRlLpgW6YaTSWzdOXTZrRBR5H 0OWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NQevYCMn; 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 v65-20020a632f44000000b0054fd9e9b862si7631100pgv.232.2023.07.14.17.51.45; Fri, 14 Jul 2023 17:52:14 -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=NQevYCMn; 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 S229965AbjGOALs (ORCPT + 99 others); Fri, 14 Jul 2023 20:11:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229455AbjGOALq (ORCPT ); Fri, 14 Jul 2023 20:11:46 -0400 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 619153A84 for ; Fri, 14 Jul 2023 17:11:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689379905; x=1720915905; h=message-id:subject:from:to:cc:date:in-reply-to: references:content-transfer-encoding:mime-version; bh=77qiGRubk75GY4oTDZJb3XK2FFdx14QYxTnO6rGu+SQ=; b=NQevYCMnOBZx4rnUbgQ5/3Gfg+sUGq35UzB+sb/DTTTRLaOZ83vd/qjy H8BdKWIxw11za1Iw1Zjdk2IOAkyMTVTjy/CmDH60gS8j9EZAE94zdAsE8 krr3AetTVvsGx8+p6iPcLm3sgHA5E3tV8MKxlzJva9L41l0kZO6mIZxiO 57I95j4S3j/YRJP/JgYgRKIjeuEiDRFdsyuedrfDckSvModFbTOnMblFB oUDcznUNzAk69PBrwKfSFD0pmZfjE7KRPwBSSOrurSCzQuoyP6CF4pCzj 5e3eCRzoacLV8s9mD1Xntm7s74nedsGc9rEd1dLMhQKBBVjmv+obBCd21 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10771"; a="365647631" X-IronPort-AV: E=Sophos;i="6.01,206,1684825200"; d="scan'208";a="365647631" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2023 17:11:44 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10771"; a="672868380" X-IronPort-AV: E=Sophos;i="6.01,206,1684825200"; d="scan'208";a="672868380" Received: from bmuller-mobl.amr.corp.intel.com (HELO [10.209.37.94]) ([10.209.37.94]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2023 17:11:43 -0700 Message-ID: <04c369a9087353270a17ab474dd6ba88cf3a3df9.camel@linux.intel.com> Subject: Re: [Patch v3 3/6] sched/fair: Implement prefer sibling imbalance calculation between asymmetric groups From: Tim Chen To: Shrikanth Hegde , Peter Zijlstra Cc: Juri Lelli , Vincent Guittot , Ricardo Neri , "Ravi V . Shankar" , Ben Segall , Daniel Bristot de Oliveira , Dietmar Eggemann , Len Brown , Mel Gorman , "Rafael J . Wysocki" , Srinivas Pandruvada , Steven Rostedt , Valentin Schneider , Ionela Voinescu , x86@kernel.org, linux-kernel@vger.kernel.org, Srikar Dronamraju , naveen.n.rao@linux.vnet.ibm.com, Yicong Yang , Barry Song , Chen Yu , Hillf Danton , Tobias Huschle Date: Fri, 14 Jul 2023 17:11:42 -0700 In-Reply-To: References: <4eacbaa236e680687dae2958378a6173654113df.1688770494.git.tim.c.chen@linux.intel.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4 (3.44.4-2.fc36) MIME-Version: 1.0 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, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Fri, 2023-07-14 at 18:44 +0530, Shrikanth Hegde wrote: >=20 > > + /* Take advantage of resource in an empty sched group */ > > + if (imbalance =3D=3D 0 && local->sum_nr_running =3D=3D 0 && > > + busiest->sum_nr_running > 1) > > + imbalance =3D 2; > > + >=20 > I don't see how this case would be true. When there are unequal number of= cores and local->sum_nr_ruuning=20 > is 0, and busiest->sum_nr_running is atleast 2, imbalance will be atleast= 1.=20 I think you are correct. With at least 2 task in the busiest group, imbalance will be at least 1. This is the effect of doing rounding when adding the (ncores_local + ncores_busy) rounding factor. =20 Returning an imbalance value of 1 will not be correct as we will be dividing imbalance by 2 and we will still not move task to the empty group as intended.=20 So this code should be updated as below: diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 3fc8d3a3bd22..16bf75e6a775 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9400,7 +9400,7 @@ static inline long sibling_imbalance(struct lb_env *e= nv, 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 Tim