From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932402AbcH1STw (ORCPT ); Sun, 28 Aug 2016 14:19:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53808 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755653AbcH1STv (ORCPT ); Sun, 28 Aug 2016 14:19:51 -0400 From: Jiri Olsa To: Peter Zijlstra Cc: Jean-Pierre Lozi , Jirka Hladky , =?UTF-8?q?Petr=20Sur=C3=BD?= , lkml , Ingo Molnar , Thomas Gleixner , "H. Peter Anvin" Subject: [PATCH] x86/topology: Fallback to SMT level only once Date: Sun, 28 Aug 2016 20:19:46 +0200 Message-Id: <1472408386-5254-1-git-send-email-jolsa@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Sun, 28 Aug 2016 18:19:50 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jirka, Peter and Jean-Pierre reported performance drop on some cpus after making cpu offline and online again. The reason is the kernel logic that falls back to SMT level topology if more than one node is detected within CPU package. During the system boot this logic cuts out the DIE topology level and numa code adds NUMA level on top of this. After the boot if you reboot make the cpu offline and online again, this logic resets the SMT level topology, removing whole NUMA level stuff. Ensuring the SMT topology fallback happens only once during the boot so the NUMA topology level is kept once it's built. This problem is one of the issues reported in the wastedcores article [1]. There's similar patch to this issue attached to the article [2]. [1] https://github.com/jplozi/wastedcores [2] https://github.com/jplozi/wastedcores/blob/master/patches/missing_sched_domains_linux_4.1.patch Cc: Jean-Pierre Lozi Cc: Jirka Hladky Cc: Petr SurĂ½ Signed-off-by: Jiri Olsa --- arch/x86/kernel/smpboot.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 2a6e84a30a54..f2a769b2b3fe 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -487,7 +487,17 @@ static struct sched_domain_topology_level numa_inside_package_topology[] = { */ static void primarily_use_numa_for_topology(void) { - set_sched_topology(numa_inside_package_topology); + static bool once; + + /* + * We need to run it only during boot, once we are + * here due to getting cpu online again we have already + * NUMA topology setup done. + */ + if (!once) { + set_sched_topology(numa_inside_package_topology); + once = true; + } } void set_cpu_sibling_map(int cpu) -- 2.7.4