On 2025/2/28 19:10, Dietmar Eggemann wrote:
On 18/02/2025 15:10, Yicong Yang wrote:
quoted
From: Yicong Yang <yangyicong@hisilicon.com>
[...]
quoted
diff --git a/include/linux/topology.h b/include/linux/topology.h
index 52f5850730b3..b3aba443c4eb 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -240,6 +240,28 @@ static inline const struct cpumask *cpu_smt_mask(int cpu)
}
#endif
+#ifndef topology_is_primary_thread
+
+#define topology_is_primary_thread topology_is_primary_thread
+
+static inline bool topology_is_primary_thread(unsigned int cpu)
+{
+ /*
+ * On SMT hotplug the primary thread of the SMT won't be disabled.
+ * Architectures do have a special primary thread (e.g. x86) need
+ * to override this function. Otherwise just make the first thread
+ * in the SMT as the primary thread.
+ *
+ * The sibling cpumask of an offline CPU contains always the CPU
+ * itself for architectures using CONFIG_GENERIC_ARCH_TOPOLOGY.
+ * Other architectures should use this depend on their own
+ * situation.
This sentence is hard to get. Do you want to say that other
architectures (CONFIG_GENERIC_ARCH_TOPOLOGY or
!CONFIG_GENERIC_ARCH_TOPOLOGY) have to check whether they can use this
default implementation or have to override it?
yes exactly, will improve the comments. thanks.