Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp71101rwl; Thu, 6 Apr 2023 13:22:06 -0700 (PDT) X-Google-Smtp-Source: AKy350YCPcUzdOdrmmYKpaKJ9yg7mpsO0WSzkZISqaLmgm73t+xy9D5Fketc2mnLHejmkL+qYRSw X-Received: by 2002:a17:906:2b16:b0:930:f953:9614 with SMTP id a22-20020a1709062b1600b00930f9539614mr194713ejg.1.1680812525964; Thu, 06 Apr 2023 13:22:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680812525; cv=none; d=google.com; s=arc-20160816; b=R01zfDU+pravqwOBDfW4fJ6vDFtjn6ZBFsaQ94yl3RnQltQrAB0lP9uYG6LNdvnzaV fb5MWMecsL1b9lnSamcYg9nv+VtW4NnrUi3hBY3fT2z/8wa5gdOBfD+/SiafMwjC1PDB 47UYfEnWkZmNeUx/YOftfITZuSj+eRFGdwDrEbKriw8s3Y3u/+7UxsJSYtAYKy4aCsZm BZlCTZ4mz8odBowqPS0rhBdxGt+refOlXiPqiKQ52tke1OLIh5PCTpPD0c7WrPkSYK4q /FvXfWoaqL4L6Y3FCGUgE1htH2KcWxNtU0LwEGHW6z5qlrA2+Xv0ineiKZxzqeA4YN0g JSZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=uZoy0UDbWyJ4hxsGxvUsT11pg7KdGrTVKfqb+PgZbMU=; b=L57jpNjEKRIYhh5/RaL6arzlP1bGWMZ8G1Tmv/f6TWwX5B2qQ87YZpfJvRZoICxZhH hQ/4vqy2KOUgv+1nJS01SzVczS/IcYDFgSgnwstTe3pviMDiSr5tha2kwyABXJGxLVLx T79hpHkc72haXySaxfdW0z/2MQt0nkNFcCZJDblzjXQriumvf6wnAsJjm51KnnZdRk// uUzd/ua/vdKVeFbk2esm3g24rD1eCgqu58gNqmKCRHkfnCVU7+8yozYSUEYKXRUVm0rC 2GEF8wSOYXALv17hbinDmBsf8oo5JDnVxqDAELwvl/4wjfu8BiKBQCMqXlkXxbqf9CAg LBfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fG3dgqz0; 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 q1-20020a170906b28100b0093d1bbf9fdcsi1757990ejz.926.2023.04.06.13.21.39; Thu, 06 Apr 2023 13:22:05 -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=fG3dgqz0; 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 S239116AbjDFUVR (ORCPT + 99 others); Thu, 6 Apr 2023 16:21:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238930AbjDFUVC (ORCPT ); Thu, 6 Apr 2023 16:21:02 -0400 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02ADB7692 for ; Thu, 6 Apr 2023 13:21:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1680812461; x=1712348461; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=q9lpW5CCgNjM7DsoYSjF+xIt0wsd4M8NGDVcidOL3Zk=; b=fG3dgqz0XrIPgnB8hjiqX40HhKIUSiAPVwljN64n4WDm7mO7PSakvvmZ Lt/nG1JtzU9ZoBxolgS4OSw30gjmw6xhaen9JLOY0VMz0wTHZwiMUaxwI HCKqpvwC6yzl3RnWqXLmHr0AGN8KjSKK/CsbXAS/l4BJMlAy02MYnE0DF K4VooKYfQc6pIRiINDZAb/+6TvzctMhIQzfFInDAlITl0HMY8bhFTHAvw NGBv5OqkleKHyHCsVzqumVEcdQ/3BQONvKeducAz0LTixW+9S9PNa86uW mHYTJaCxBAq8AYh7I3Vx+ZEwk11xlzAlAIIbxrKx9w6Qr2FB3rJnYmHQK g==; X-IronPort-AV: E=McAfee;i="6600,9927,10672"; a="407957743" X-IronPort-AV: E=Sophos;i="5.98,323,1673942400"; d="scan'208";a="407957743" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Apr 2023 13:20:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10672"; a="861529878" X-IronPort-AV: E=Sophos;i="5.98,323,1673942400"; d="scan'208";a="861529878" Received: from ranerica-svr.sc.intel.com ([172.25.110.23]) by orsmga005.jf.intel.com with ESMTP; 06 Apr 2023 13:20:59 -0700 From: Ricardo Neri To: "Peter Zijlstra (Intel)" , Juri Lelli , Vincent Guittot Cc: Ricardo Neri , "Ravi V. Shankar" , Ben Segall , Daniel Bristot de Oliveira , Dietmar Eggemann , Len Brown , Mel Gorman , "Rafael J. Wysocki" , Srinivas Pandruvada , Steven Rostedt , Tim Chen , Valentin Schneider , Ionela Voinescu , x86@kernel.org, linux-kernel@vger.kernel.org, Ricardo Neri , "Tim C . Chen" Subject: [PATCH v4 05/12] sched/fair: Keep a fully_busy SMT sched group as busiest Date: Thu, 6 Apr 2023 13:31:41 -0700 Message-Id: <20230406203148.19182-6-ricardo.neri-calderon@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230406203148.19182-1-ricardo.neri-calderon@linux.intel.com> References: <20230406203148.19182-1-ricardo.neri-calderon@linux.intel.com> X-Spam-Status: No, score=-2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 When comparing two fully_busy scheduling groups, keep the current busiest group if it represents an SMT core. Tasks in such scheduling group share CPU resources and need more help than tasks in a non-SMT fully_busy group. Cc: Ben Segall Cc: Daniel Bristot de Oliveira Cc: Dietmar Eggemann Cc: Ionela Voinescu Cc: Len Brown Cc: Mel Gorman Cc: Rafael J. Wysocki Cc: Srinivas Pandruvada Cc: Steven Rostedt Cc: Tim C. Chen Cc: Valentin Schneider Cc: x86@kernel.org Cc: linux-kernel@vger.kernel.org Tested-by: Zhang Rui Signed-off-by: Ricardo Neri --- Changes since v3: * None Changes since v2: * Introduced this patch. Changes since v1: * N/A --- kernel/sched/fair.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index b151e93ec316..ea23a5163bfa 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9566,10 +9566,22 @@ static bool update_sd_pick_busiest(struct lb_env *env, * contention when accessing shared HW resources. * * XXX for now avg_load is not computed and always 0 so we - * select the 1st one. + * select the 1st one, except if @sg is composed of SMT + * siblings. */ - if (sgs->avg_load <= busiest->avg_load) + + if (sgs->avg_load < busiest->avg_load) return false; + + if (sgs->avg_load == busiest->avg_load) { + /* + * SMT sched groups need more help than non-SMT groups. + * If @sg happens to also be SMT, either choice is good. + */ + if (sds->busiest->flags & SD_SHARE_CPUCAPACITY) + return false; + } + break; case group_has_spare: -- 2.25.1