Messages in this thread | | | Date | Thu, 12 May 2016 10:07:24 +0200 | From | Ingo Molnar <> | Subject | Re: [UPDATED PATCH 01/10] x86: Add topology_max_smt_threads() |
| |
* Andi Kleen <andi@firstfloor.org> wrote:
> For SMT specific workarounds it is useful to know if SMT is active > on any online CPU in the system. This currently requires a loop > over all online CPUs. > > Add a global variable that is updated with the maximum number > of smt threads on any CPU on online/offline, and use it for > topology_max_smt_threads() > > The single call is easier to use than a loop. > > Not exported to user space because user space already can use > the existing sibling interfaces to find this out. > > v2: Code formatting changes and use __ for variable name > Cc: tglx@linutronix.de > Signed-off-by: Andi Kleen <ak@linux.intel.com> > > diff --git a/arch/x86/include/asm/topology.h b/arch/x86/include/asm/topology.h > index 7f991bd5031b..f79181c03561 100644 > --- a/arch/x86/include/asm/topology.h > +++ b/arch/x86/include/asm/topology.h > @@ -129,6 +129,10 @@ extern const struct cpumask *cpu_coregroup_mask(int cpu); > > extern unsigned int __max_logical_packages; > #define topology_max_packages() (__max_logical_packages) > + > +extern int __max_smt_threads; > +#define topology_max_smt_threads() __max_smt_threads > + > int topology_update_package_map(unsigned int apicid, unsigned int cpu); > extern int topology_phys_to_logical_pkg(unsigned int pkg); > #else > @@ -136,6 +140,7 @@ extern int topology_phys_to_logical_pkg(unsigned int pkg); > static inline int > topology_update_package_map(unsigned int apicid, unsigned int cpu) { return 0; } > static inline int topology_phys_to_logical_pkg(unsigned int pkg) { return 0; } > +#define topology_max_smt_threads() 1
Is there a good reason why this is a CPP macro instead of an inline function like the code above it uses?
> +/* Recompute SMT state for all CPUs on offline */
s/when a CPU gets offlined/
Thanks,
Ingo
| |