From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758417AbcEFKtS (ORCPT ); Fri, 6 May 2016 06:49:18 -0400 Received: from www.linutronix.de ([62.245.132.108]:58653 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758069AbcEFKtM (ORCPT ); Fri, 6 May 2016 06:49:12 -0400 Date: Fri, 6 May 2016 12:47:18 +0200 (CEST) From: Thomas Gleixner To: Peter Zijlstra cc: Andi Kleen , acme@kernel.org, jolsa@kernel.org, linux-kernel@vger.kernel.org, Andi Kleen , x86@kernel.org Subject: Re: [PATCH 01/10] x86: Add topology_max_smt_threads() In-Reply-To: <20160506101318.GV3430@twins.programming.kicks-ass.net> Message-ID: References: <1462489447-31832-1-git-send-email-andi@firstfloor.org> <1462489447-31832-2-git-send-email-andi@firstfloor.org> <20160506101318.GV3430@twins.programming.kicks-ass.net> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 6 May 2016, Peter Zijlstra wrote: > On Thu, May 05, 2016 at 04:03:58PM -0700, Andi Kleen wrote: > > > > extern unsigned int __max_logical_packages; > > #define topology_max_packages() (__max_logical_packages) > > + > > +extern int max_smt_threads; Please follow the above convention and prepend it with underscores. That way it's clear that the variable should not be touched outside of the core which initializes it. > > +#define topology_max_smt_threads() max_smt_threads > > + > > static inline void smpboot_setup_warm_reset_vector(unsigned long start_eip) > > { > > unsigned long flags; > > @@ -489,6 +492,7 @@ void set_cpu_sibling_map(int cpu) > > struct cpuinfo_x86 *c = &cpu_data(cpu); > > struct cpuinfo_x86 *o; > > int i; > > + int threads; int i, threads; Please > > > > cpumask_set_cpu(cpu, cpu_sibling_setup_mask); > > > > @@ -545,6 +549,10 @@ void set_cpu_sibling_map(int cpu) > > if (match_die(c, o) && !topology_same_node(c, o)) > > primarily_use_numa_for_topology(); > > } > > + > > + threads = cpumask_weight(topology_sibling_cpumask(cpu)); > > + if (threads > max_smt_threads) > > + max_smt_threads = threads; > > } > > > > /* maps the cpu to the sched domain representing multi-core */ > > @@ -1436,6 +1444,21 @@ __init void prefill_possible_map(void) > > > > #ifdef CONFIG_HOTPLUG_CPU > > > > +/* Recompute SMT state for all CPUs on offline */ > > +static void recompute_smt_state(void) > > +{ > > + int max_threads; > > + int cpu; Ditto > > + > > + max_threads = 0; > > + for_each_online_cpu (cpu) { > > + int threads = cpumask_weight(topology_sibling_cpumask(cpu)); Missing newline. Otherwise that looks good. Thanks, tglx