From patchwork Tue Nov 22 20:35:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Neri X-Patchwork-Id: 24552 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2425648wrr; Tue, 22 Nov 2022 12:31:55 -0800 (PST) X-Google-Smtp-Source: AA0mqf6XcFD0oxKQRhk3wwO02AnwUE5+E79v+c9SGzXrwUwPRNAJmBdPqxiBTszx1f7gModArfeT X-Received: by 2002:a17:906:c40d:b0:7af:1534:73c9 with SMTP id u13-20020a170906c40d00b007af153473c9mr5008889ejz.558.1669149115291; Tue, 22 Nov 2022 12:31:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669149115; cv=none; d=google.com; s=arc-20160816; b=bT4N9zgTLM3uWWK+8r1M2X0Pf5de1x6iQWSTtjpbyVKPBLg2oBe6zVTJ/tPi+EM1ip ZRAWk6MfyiQLeDh1rwfgmsf07P4xi7yq9DFOUlAKxeHS05tAwUH0YDwyNkP1eNLIaEhd J+2EEHQpuuCJTmmfnEHYEvcZYdewZ+G2iRFlwZ9FJkFf4/09levsNbRyWHhDGCy8/MZ0 TM7XX3v/ip9RMehaEC7fXVZAJ93kZ48h5FPf8THMqIP5XE0XplYLyMit38o+dAM4KUs8 pRTlrBv7UxTg48hSSttPosG/JuGjKHRaHnHt6er95XRIOdVwIU09fo8230qXaoDnIoWe tOMw== 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=4DUKlbW0j5sTgrSqzx8AqNnWpJYrLD/1IZEdUnnGrHc=; b=o3lRHfPbMkZQUhZEMftEtVRgU0E2oNz44wgl2kpmtc2QruYec9v3mVvEExjGNZuuaT d0C55YE++faaQwHzZ3G4uQoZ0csDx85NFYOWkoOCwFRkG2WFGF+z8W2ZPEP1fHVusrku phw+vn3KgZBhTmsyHVhtgwr6AJ04EsgHXq5DglN8obCBPfhdLN55a9yCnWj+tk1yy5ae qoo7wVH2+Z0IEMyuZQYkLIcrQz5idnRAU7S08eM8M+TpED8UW+AMeRnTbEU2R7BW/f/V IFt4xHIGr6XA926R4kel09Dei7A2vv087eAvSfzVNo9hNH5jqF5ib6xUBe3i3J3C08su rrhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NKkxiZ5F; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g14-20020a1709065d0e00b007ae9abf1990si14607889ejt.352.2022.11.22.12.31.31; Tue, 22 Nov 2022 12:31:55 -0800 (PST) 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=NKkxiZ5F; 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 S232734AbiKVU2t (ORCPT + 99 others); Tue, 22 Nov 2022 15:28:49 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234546AbiKVU2R (ORCPT ); Tue, 22 Nov 2022 15:28:17 -0500 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DAD515805 for ; Tue, 22 Nov 2022 12:28:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669148896; x=1700684896; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=jiYnvM57QdQau/H42shFzT9M5SGTODsNBjdPxNUJhmI=; b=NKkxiZ5Fji9Mkd6TVOXWtDrKNQtE8xJFI7uZ6aSxJFzMgHhILdr0ssmV r5ep01bB53BDuAEVNBvek40Lsgc/1t53rkw4UyJay949WgIc9kRau3h2/ yAPe2fA3H8F1eNzGMTb3v6q0i/PtPLYeqhX3EKw0azbWMt9lakzI2JFP+ 0za1zHOj8Qb/eQwJJumNo3w7VaqG3koknHzmLvOhp7uvbnY+u/awOkiAW cblmNU1rCO7pJAhb//e/iwl17pqffbyr4gghdJ0mWabcLNr88942yt6kS zOr3zB5oeAV8TCcZwTAW7KnTL/CN3WSYIRoqj0teW/MWe3NfCI+YHJuoI w==; X-IronPort-AV: E=McAfee;i="6500,9779,10539"; a="293616515" X-IronPort-AV: E=Sophos;i="5.96,185,1665471600"; d="scan'208";a="293616515" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2022 12:28:16 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10539"; a="816228147" X-IronPort-AV: E=Sophos;i="5.96,185,1665471600"; d="scan'208";a="816228147" Received: from ranerica-svr.sc.intel.com ([172.25.110.23]) by orsmga005.jf.intel.com with ESMTP; 22 Nov 2022 12:28:15 -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 , x86@kernel.org, linux-kernel@vger.kernel.org, Ricardo Neri , "Tim C . Chen" Subject: [PATCH v2 7/7] x86/sched/itmt: Consider the idle state of SMT siblings Date: Tue, 22 Nov 2022 12:35:32 -0800 Message-Id: <20221122203532.15013-8-ricardo.neri-calderon@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221122203532.15013-1-ricardo.neri-calderon@linux.intel.com> References: <20221122203532.15013-1-ricardo.neri-calderon@linux.intel.com> X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_PASS, SPF_NONE 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750229702463060866?= X-GMAIL-MSGID: =?utf-8?q?1750229702463060866?= Cores with more than one busy SMT sibling need help from fully idle cores, even if they have lower priority. Return a priority of 0 if any of the SMT siblings of a CPU are busy. This lets lower-priority idle cores pull tasks from the CPU. Only do this if the scheduler cares about the idle state of the siblings. 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 v1: * Introduced this patch. --- arch/x86/kernel/itmt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/itmt.c b/arch/x86/kernel/itmt.c index 2be49ce4f94a..cb22944969a1 100644 --- a/arch/x86/kernel/itmt.c +++ b/arch/x86/kernel/itmt.c @@ -169,7 +169,10 @@ void sched_clear_itmt_support(void) int arch_asym_cpu_priority(int cpu, bool check_smt) { - return per_cpu(sched_core_priority, cpu); + if (!check_smt || sched_smt_siblings_idle(cpu)) + return per_cpu(sched_core_priority, cpu); + + return 0; } /**