From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 16C133EB0F8 for ; Thu, 25 Jun 2026 16:41:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782405697; cv=none; b=GmJoIvWhStCZZmY/YHSRbwlNOMzwX/ukODuS4SF8zObOnUawwvQRYVsdj3+5obOSlYAmfMJaevEfOn6xLiF9zvm6A6RcjJBA3ysjuIStlqHSLk6h8IOxZ1GmLBS60MkMVpcUaK0O4kLah/C0oodJWw0JznBV8iyl0zX8eXKv81M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782405697; c=relaxed/simple; bh=kWCBjizwEc1v+QYWI5+i1I3yr5kczmUiq18cc/ZjrLo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XKbD1vabJmuGR1JjaR22HRj4713yyPQy1j2bWHNjCPo+Y30dw8NdlqqpJoVQvCmiaok/FaYaEjxNFPrxJfS1scgLNuy1mUZDcqk+egxv859DV+nTpSTMXHBU9FU0v+VdFTsk9f1ODHQWmlbpLQMifjQsj3TP41UulvR2NbAAZW8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TJZidBbH; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="TJZidBbH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 216561F00A3D; Thu, 25 Jun 2026 16:41:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1782405693; bh=Mugbh6EeRtJkvtvVZITbBTP14cODpdOXOjHeB2Fd8G8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=TJZidBbHOf0Vjc1aFZPAl0EI4IXTMsCtw7IW4Qgxq4+rbZ8TGeh4b5EmO9JAjeZqH 3+tHPOYFp9UfqNLIQD6olPEJyfqVR6MxkVqKuU3GEcxLA8Mi2BIygZH2bZ72a9XkMP rCSD9kScBDCUGSVl7n3uGE0zL/A1NPYQy8qcr38vPXquOy5VaJYFb7iovQOAvEPt6g SYSwTT9HWQVkpgyT1rA4a544Hebx2QX73so5jd6Cj2Vj7sWzf3Wm7JA7qB38DZIw59 gOe9lQo/rKZ5BXkIPLxYgkAcsOazORJ681WeKD/Pm2Vi0Cyf/VDb0/M1tuOKPwMLvM ZLIrV0anmhqcg== From: Frederic Weisbecker To: Christian Loehle Cc: LKML , Frederic Weisbecker , Anna-Maria Behnsen , Sehee Jeong , Thomas Gleixner , Peter Zijlstra Subject: [PATCH 3/6] sched/topology: Account asym capacities number Date: Thu, 25 Jun 2026 18:41:11 +0200 Message-ID: <20260625164114.51454-4-frederic@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260625164114.51454-1-frederic@kernel.org> References: <20260625164114.51454-1-frederic@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The timer migration code will need to know the number of capacities in the system and the maximum number of CPUs a capacity can contain in order to build the tree accordingly. Prepare the relevant APIs. Signed-off-by: Frederic Weisbecker --- include/linux/sched/topology.h | 2 ++ kernel/sched/topology.c | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h index b5d9d7c2b8ad..88632825136e 100644 --- a/include/linux/sched/topology.h +++ b/include/linux/sched/topology.h @@ -50,6 +50,8 @@ extern const struct cpumask *tl_mc_mask(struct sched_domain_topology_level *tl, extern const struct cpumask *tl_pkg_mask(struct sched_domain_topology_level *tl, int cpu); extern int arch_asym_cpu_priority(int cpu); +extern int sched_asym_count(void); +extern int sched_asym_max_cpus(void); struct sched_domain_attr { int relax_domain_level; diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c index 622e2e01974c..3b3bd32aea40 100644 --- a/kernel/sched/topology.c +++ b/kernel/sched/topology.c @@ -1746,6 +1746,20 @@ static inline void asym_cpu_capacity_update_data(int cpu) __cpumask_set_cpu(cpu, cpu_capacity_span(entry)); } +static int asym_capacity_nr; + +int sched_asym_count(void) +{ + return asym_capacity_nr; +} + +static int asym_capacity_max_cpus; + +int sched_asym_max_cpus(void) +{ + return asym_capacity_max_cpus; +} + /* * Build-up/update list of CPUs grouped by their capacities * An update requires explicit request to rebuild sched domains @@ -1756,6 +1770,9 @@ static void asym_cpu_capacity_scan(void) struct asym_cap_data *entry, *next; int cpu; + asym_capacity_nr = 0; + asym_capacity_max_cpus = 0; + list_for_each_entry(entry, &asym_cap_list, link) cpumask_clear(cpu_capacity_span(entry)); @@ -1766,6 +1783,13 @@ static void asym_cpu_capacity_scan(void) if (cpumask_empty(cpu_capacity_span(entry))) { list_del_rcu(&entry->link); call_rcu(&entry->rcu, free_asym_cap_entry); + } else { + int weight; + + asym_capacity_nr++; + weight = cpumask_weight(cpu_capacity_span(entry)); + if (weight > asym_capacity_max_cpus) + asym_capacity_max_cpus = weight; } } -- 2.53.0