Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 958F2C636CD for ; Tue, 7 Feb 2023 04:51:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229992AbjBGEvK (ORCPT ); Mon, 6 Feb 2023 23:51:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229924AbjBGEut (ORCPT ); Mon, 6 Feb 2023 23:50:49 -0500 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14E344ECC for ; Mon, 6 Feb 2023 20:50:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675745448; x=1707281448; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=ulLn873Z56iFQvxm4YOPwOFsRDQ7WudOQQX77xthURc=; b=SzkE43STwpMyQxRVXh1tqpIqgXttsqg5ePJ5eHfmPIEUGXPrrKS4B6fJ 7aQALzxucFatxuMoEd9qzkLhSOKpFVn83NMhDa4C7VrydQoHLMG3Pma4d kik/WQkjKVXSYYmBYdk9TtfuRnXd5w8BRNlSlcml6KQItel0s8YZAbB/J dJbt8dgzFh/i9LrG+g0LlT09oxmCQcTyHOTrXkdJUkSWtCUfRjF1qiuKs vdyKT3yDTCQBqF+rCeoqLJiJKT9AVjJoqqQQWe+bPwfOuedn/ftc9FQ8v LBe3R4fkrT0nIacAadNbrimb5ZYe6hdtGs+G6hJT+REbElVRsNFsdx1Hg w==; X-IronPort-AV: E=McAfee;i="6500,9779,10613"; a="415624014" X-IronPort-AV: E=Sophos;i="5.97,278,1669104000"; d="scan'208";a="415624014" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Feb 2023 20:50:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10613"; a="668653792" X-IronPort-AV: E=Sophos;i="5.97,278,1669104000"; d="scan'208";a="668653792" Received: from ranerica-svr.sc.intel.com ([172.25.110.23]) by fmsmga007.fm.intel.com with ESMTP; 06 Feb 2023 20:50:46 -0800 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 v3 05/10] sched/fair: Keep a fully_busy SMT sched group as busiest Date: Mon, 6 Feb 2023 20:58:33 -0800 Message-Id: <20230207045838.11243-6-ricardo.neri-calderon@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20230207045838.11243-1-ricardo.neri-calderon@linux.intel.com> References: <20230207045838.11243-1-ricardo.neri-calderon@linux.intel.com> 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: 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 Signed-off-by: Ricardo Neri --- 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 c9d0ddfd11f2..df7bcbf634a8 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9514,10 +9514,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