From patchwork Tue Nov 22 20:35:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Neri X-Patchwork-Id: 24551 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2425292wrr; Tue, 22 Nov 2022 12:31:09 -0800 (PST) X-Google-Smtp-Source: AA0mqf4K/aJIVwki5AoAcjPZLauX8oKkaO0CocwKi2FTUkhyg47mlfIrK08axXQR6cfazGn5Za+O X-Received: by 2002:a17:906:b250:b0:7b2:86d5:8b14 with SMTP id ce16-20020a170906b25000b007b286d58b14mr21512698ejb.230.1669149069009; Tue, 22 Nov 2022 12:31:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669149069; cv=none; d=google.com; s=arc-20160816; b=OlchyDqLKzS7d0hOtA/mX+0A87qdohP6TWvsnI8sa32Pz9vnZFhtrTdlJBnZQj5Xor u013elNa8iQqNs6p8aPPOeOhvxZvaALMtKRCKziN/AzaGL53EGEG+tq1hRHRa+fAR2gf 96tqjNc3G1JVy/Tx8ljS6eFzv9s6By5Rd/GQyOOVPsrbj0Ir7B/9v46eyHeMqE4IyI3d 36yv1Ffe6QxF3poarBlHw4t+e078sPk7ixANzFFExfXVNpTnriOYIQdIQIrdkpJUa75p KlEsJDQyMJUrAcNX6SD0Lk13gkfZjXNBa86bemSzJJNVmLkoDMS5oLSO1oWIz49iiCbl GYLQ== 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=O2VA3TrA3wMitC3cActLADpuw7WbICZ5lqU3DMkyj2c=; b=BSdR/58M87gjysdtvMyUiTULG0nPOWEZ26CL0uVq0TGAQlQFBIKvfsj+xD1E8pbfFq Ty4rjoY3btb0V9of3JX1xOqukcGHiF8Qv5iWpoGoEuQFnp394D2npN3X9KQVwreqgEYS IX9m2Yu2G/whCXCBR5O2FwNmVPD3MiBpuqtl5tGdVj707LuL8j7D1ytPHCGtD+TJX6W9 x4xEAN7Mc2w8Rz6UpqeOOWTE++HSScIi2OdllqI5nGo9rvedKHkiBdWD5wlX4JdesVkg l81dTjZtbVSzxPpVhf3Jr/J+nwLzhj0MIXs4azEeD8LbcvZZi6VcrEMwPjkZvrZR2kth PNzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=UsM+efA2; 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 y15-20020a056402270f00b0045d4a88c735si13382561edd.220.2022.11.22.12.30.45; Tue, 22 Nov 2022 12:31:08 -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=UsM+efA2; 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 S234865AbiKVU2p (ORCPT + 99 others); Tue, 22 Nov 2022 15:28:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234528AbiKVU2Q (ORCPT ); Tue, 22 Nov 2022 15:28:16 -0500 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDEBE14D07 for ; Tue, 22 Nov 2022 12:28:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1669148895; x=1700684895; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=bhiwDeK4ICYY9tIKImH8FX+AqBh+ctstEwbC4wBb3kI=; b=UsM+efA2znobHYPGHWvHjZfJetf7YQSNUD2EqNJq44+DhN4OJsRSU38t q7u0pB+hGpumF4AJMOtyMZoB5Nm0FhTY2GaVyNaod7DK1RI7bLcWk1n06 nFpRgTJTEIUi2jzsS3X8tL6t1MWWzCVx3Ol5ujOGZTINcWU/YAPaj79dy irEktVOVkX2qEyAbRV8G+f+dgVIsosVSQ7kNqg7h1/cyBduRPJKzXJLuY PD/PFfdIivrjP0tXRoP/WLfFskbBfTAIUmHsLeNv74GVQAB7IlMwt3DMg dyWLRouVx+RVBAEI8rqCLvTCZiOdduA8oGUr6A/bX3H/UkyUZRjLQLsra w==; X-IronPort-AV: E=McAfee;i="6500,9779,10539"; a="293616514" X-IronPort-AV: E=Sophos;i="5.96,185,1665471600"; d="scan'208";a="293616514" 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:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10539"; a="816228144" X-IronPort-AV: E=Sophos;i="5.96,185,1665471600"; d="scan'208";a="816228144" 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 6/7] x86/sched/itmt: Give all SMT siblings of a core the same priority Date: Tue, 22 Nov 2022 12:35:31 -0800 Message-Id: <20221122203532.15013-7-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?1750229653987626546?= X-GMAIL-MSGID: =?utf-8?q?1750229653987626546?= Currently, each SMT sibling is given a priority that ensures that in partially busy systems load is evenly spread among cores. There is, however, no difference in performance among the SMT siblings of a core. Having different priorities for each SMT sibling triggers unnecessary load balancing towards the higher-priority sibling. 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 Reviewed-by: Len Brown Signed-off-by: Ricardo Neri --- Changes since v1: * Reworded commit message for clarity. --- arch/x86/kernel/itmt.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/arch/x86/kernel/itmt.c b/arch/x86/kernel/itmt.c index 4cb5a5e4fa47..2be49ce4f94a 100644 --- a/arch/x86/kernel/itmt.c +++ b/arch/x86/kernel/itmt.c @@ -174,32 +174,19 @@ int arch_asym_cpu_priority(int cpu, bool check_smt) /** * sched_set_itmt_core_prio() - Set CPU priority based on ITMT - * @prio: Priority of cpu core - * @core_cpu: The cpu number associated with the core + * @prio: Priority of @cpu + * @cpu: The CPU number * * The pstate driver will find out the max boost frequency * and call this function to set a priority proportional - * to the max boost frequency. CPU with higher boost + * to the max boost frequency. CPUs with higher boost * frequency will receive higher priority. * * No need to rebuild sched domain after updating * the CPU priorities. The sched domains have no * dependency on CPU priorities. */ -void sched_set_itmt_core_prio(int prio, int core_cpu) +void sched_set_itmt_core_prio(int prio, int cpu) { - int cpu, i = 1; - - for_each_cpu(cpu, topology_sibling_cpumask(core_cpu)) { - int smt_prio; - - /* - * Ensure that the siblings are moved to the end - * of the priority chain and only used when - * all other high priority cpus are out of capacity. - */ - smt_prio = prio * smp_num_siblings / (i * i); - per_cpu(sched_core_priority, cpu) = smt_prio; - i++; - } + per_cpu(sched_core_priority, cpu) = prio; }