Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp1709900ybd; Wed, 26 Jun 2019 23:52:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqx6UsRkDqksip4nKUP3G1O3xQFhMBilnk0wDWBYgQ/2c8yaLx4LfPlHsMP9QviBctpEJoBd X-Received: by 2002:a65:6083:: with SMTP id t3mr2198045pgu.342.1561618360488; Wed, 26 Jun 2019 23:52:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561618360; cv=none; d=google.com; s=arc-20160816; b=xXhGjIOIDqd9M4gB6gGzS4vxgTwsQIL8+MsLdTzfHVcW7qxsl5k/C+oIBU60z7XBdr VuIz7jHcGXRRAGeTNfEmRitawF0096+l62SAu8oOqsWlhDihWHah2OPUu3CQOWJ8mA0n bd7QYawDhWtsh2KnfgXtv8LZD7c2pbtOn57AcONijUI0tG2xrJ5IzHLvlUWHwr6uDJpv xi5SsIqxa7dSs4/E28IcvNwWKSqZiBC/FHCr3X311rx0dS1I4Afxy+uAV7+OkFxVWL89 8T8x5Z9phsZbc9tDTZlcNcR4rgS8qxHYgGhRk0mmT/rB7TTHMXxBSKEL6GXkufqDL7gw CEjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=iuuSqJv23bjzA1T6+uRyOMozlsSKm0WNj+SBcD/mZc4=; b=oSQb7NJye4vTEEXhc0BNhRs2qV2I2fK7PrqqsaG80l9A+oksOnfjwffktpGdLsmoh/ Q6SItWqHqKs1TP8ZEYchVpOrWS+q9Vi3y8hS5goJHcGEh+D71JOCBA/Yo8UbfnQM4IWq 4VevS1oDR9dQVOAjC+TEBVTplzxU7Bl6zFFgwYtU82yo7H5pEQa/I/82Yo9dWNesenQ2 YDjGs7MlD8/OAjQLW9yfIRg0KVaoiNk9+jrVEZhcTFCjDj9/XsHjyW4/9Qf9AxqT90Le qGY66uH864CzAVh1lgYKkSABf9+oJzB7+WFYFHKaqTSmTNXm1hTfbjDnLM70tThj0Wbq 5gjg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c23si1756686pfo.168.2019.06.26.23.52.24; Wed, 26 Jun 2019 23:52:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726467AbfF0Gv6 (ORCPT + 99 others); Thu, 27 Jun 2019 02:51:58 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:52473 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726049AbfF0Gv5 (ORCPT ); Thu, 27 Jun 2019 02:51:57 -0400 Received: from p5b06daab.dip0.t-ipconnect.de ([91.6.218.171] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1hgOG8-0003BK-Tv; Thu, 27 Jun 2019 08:51:53 +0200 Date: Thu, 27 Jun 2019 08:51:52 +0200 (CEST) From: Thomas Gleixner To: subhra mazumdar cc: linux-kernel@vger.kernel.org, peterz@infradead.org, mingo@redhat.com, steven.sistare@oracle.com, dhaval.giani@oracle.com, daniel.lezcano@linaro.org, vincent.guittot@linaro.org, viresh.kumar@linaro.org, tim.c.chen@linux.intel.com, mgorman@techsingularity.net Subject: Re: [PATCH v3 6/7] x86/smpboot: introduce per-cpu variable for HT siblings In-Reply-To: <20190627012919.4341-7-subhra.mazumdar@oracle.com> Message-ID: References: <20190627012919.4341-1-subhra.mazumdar@oracle.com> <20190627012919.4341-7-subhra.mazumdar@oracle.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 26 Jun 2019, subhra mazumdar wrote: > Introduce a per-cpu variable to keep the number of HT siblings of a cpu. > This will be used for quick lookup in select_idle_cpu to determine the > limits of search. Why? The number of siblings is constant at least today unless you play silly cpu hotplug games. A bit more justification for adding yet another random storage would be appreciated. > This patch does it only for x86. # grep 'This patch' Documentation/process/submitting-patches.rst IOW, we all know already that this is a patch and from the subject prefix and the diffstat it's pretty obvious that this is x86 only. So instead of documenting the obvious, please add proper context to justify the change. > +/* representing number of HT siblings of each CPU */ > +DEFINE_PER_CPU_READ_MOSTLY(unsigned int, cpumask_weight_sibling); > +EXPORT_PER_CPU_SYMBOL(cpumask_weight_sibling); Why does this need an export? No module has any reason to access this. > /* representing HT and core siblings of each logical CPU */ > DEFINE_PER_CPU_READ_MOSTLY(cpumask_var_t, cpu_core_map); > EXPORT_PER_CPU_SYMBOL(cpu_core_map); > @@ -520,6 +524,8 @@ void set_cpu_sibling_map(int cpu) > > if (!has_mp) { > cpumask_set_cpu(cpu, topology_sibling_cpumask(cpu)); > + per_cpu(cpumask_weight_sibling, cpu) = > + cpumask_weight(topology_sibling_cpumask(cpu)); > cpumask_set_cpu(cpu, cpu_llc_shared_mask(cpu)); > cpumask_set_cpu(cpu, topology_core_cpumask(cpu)); > c->booted_cores = 1; > @@ -529,8 +535,12 @@ void set_cpu_sibling_map(int cpu) > for_each_cpu(i, cpu_sibling_setup_mask) { > o = &cpu_data(i); > > - if ((i == cpu) || (has_smt && match_smt(c, o))) > + if ((i == cpu) || (has_smt && match_smt(c, o))) { > link_mask(topology_sibling_cpumask, cpu, i); > + threads = cpumask_weight(topology_sibling_cpumask(cpu)); > + per_cpu(cpumask_weight_sibling, cpu) = threads; > + per_cpu(cpumask_weight_sibling, i) = threads; This only works for SMT=2, but fails to update the rest for SMT=4. > @@ -1482,6 +1494,8 @@ static void remove_siblinginfo(int cpu) > > for_each_cpu(sibling, topology_core_cpumask(cpu)) { > cpumask_clear_cpu(cpu, topology_core_cpumask(sibling)); > + per_cpu(cpumask_weight_sibling, sibling) = > + cpumask_weight(topology_sibling_cpumask(sibling)); While remove does the right thing. Thanks, tglx