From: Pingfan Liu <kernelfans@gmail.com>
To: x86@kernel.org, linux-mm@kvack.org
Cc: Pingfan Liu <kernelfans@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
"H. Peter Anvin" <hpa@zytor.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
Vlastimil Babka <vbabka@suse.cz>,
Mike Rapoport <rppt@linux.vnet.ibm.com>,
Andrew Morton <akpm@linux-foundation.org>,
Mel Gorman <mgorman@suse.de>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>,
Andy Lutomirski <luto@kernel.org>,
Andi Kleen <ak@linux.intel.com>, Petr Tesarik <ptesarik@suse.cz>,
Michal Hocko <mhocko@suse.com>,
Stephen Rothwell <sfr@canb.auug.org.au>,
Jonathan Corbet <corbet@lwn.net>,
Nicholas Piggin <npiggin@gmail.com>,
Daniel Vacek <neelx@redhat.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 4/6] x86/numa: concentrate the code of setting cpu to node map
Date: Sun, 24 Feb 2019 20:34:07 +0800 [thread overview]
Message-ID: <1551011649-30103-5-git-send-email-kernelfans@gmail.com> (raw)
In-Reply-To: <1551011649-30103-1-git-send-email-kernelfans@gmail.com>
Both numa_init_array() and init_cpu_to_node() aim at setting up the cpu to
node map, so combining them. And the coming patch will set up node to
cpumask map in the combined function.
Signed-off-by: Pingfan Liu <kernelfans@gmail.com>
CC: Thomas Gleixner <tglx@linutronix.de>
CC: Ingo Molnar <mingo@redhat.com>
CC: Borislav Petkov <bp@alien8.de>
CC: "H. Peter Anvin" <hpa@zytor.com>
CC: Dave Hansen <dave.hansen@linux.intel.com>
CC: Vlastimil Babka <vbabka@suse.cz>
CC: Mike Rapoport <rppt@linux.vnet.ibm.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Mel Gorman <mgorman@suse.de>
CC: Joonsoo Kim <iamjoonsoo.kim@lge.com>
CC: Andy Lutomirski <luto@kernel.org>
CC: Andi Kleen <ak@linux.intel.com>
CC: Petr Tesarik <ptesarik@suse.cz>
CC: Michal Hocko <mhocko@suse.com>
CC: Stephen Rothwell <sfr@canb.auug.org.au>
CC: Jonathan Corbet <corbet@lwn.net>
CC: Nicholas Piggin <npiggin@gmail.com>
CC: Daniel Vacek <neelx@redhat.com>
CC: linux-kernel@vger.kernel.org
---
arch/x86/mm/numa.c | 39 +++++++++++++--------------------------
1 file changed, 13 insertions(+), 26 deletions(-)
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
index bfe6732..c8dd7af 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
@@ -599,30 +599,6 @@ static int __init numa_register_memblks(struct numa_meminfo *mi)
return 0;
}
-#ifdef CONFIG_NUMA
-/*
- * There are unfortunately some poorly designed mainboards around that
- * only connect memory to a single CPU. This breaks the 1:1 cpu->node
- * mapping. To avoid this fill in the mapping for all possible CPUs,
- * as the number of CPUs is not known yet. We round robin the existing
- * nodes.
- */
-static void __init numa_init_array(void)
-{
- int rr, i;
-
- rr = first_node(node_online_map);
- for (i = 0; i < nr_cpu_ids; i++) {
- if (early_cpu_to_node(i) != NUMA_NO_NODE)
- continue;
- numa_set_node(i, rr);
- rr = next_node_in(rr, node_online_map);
- }
-}
-#else
-static void __init numa_init_array(void) {}
-#endif
-
static int __init numa_init(int (*init_func)(void))
{
int i;
@@ -675,7 +651,6 @@ static int __init numa_init(int (*init_func)(void))
if (!node_online(nid))
numa_clear_node(i);
}
- numa_init_array();
return 0;
}
@@ -758,14 +733,26 @@ void __init init_cpu_to_node(void)
{
int cpu;
u16 *cpu_to_apicid = early_per_cpu_ptr(x86_cpu_to_apicid);
+ int rr;
BUG_ON(cpu_to_apicid == NULL);
+ rr = first_node(node_online_map);
for_each_possible_cpu(cpu) {
int node = numa_cpu_node(cpu);
- if (node == NUMA_NO_NODE)
+ /*
+ * There are unfortunately some poorly designed mainboards
+ * around that only connect memory to a single CPU. This
+ * breaks the 1:1 cpu->node mapping. To avoid this fill in
+ * the mapping for all possible CPUs, as the number of CPUs
+ * is not known yet. We round robin the existing nodes.
+ */
+ if (node == NUMA_NO_NODE) {
+ numa_set_node(cpu, rr);
+ rr = next_node_in(rr, node_online_map);
continue;
+ }
if (!node_online(node))
init_memory_less_node(node);
--
2.7.4
next prev parent reply other threads:[~2019-02-24 12:35 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-24 12:34 [PATCH 0/6] make memblock allocator utilize the node's fallback info Pingfan Liu
2019-02-24 12:34 ` [PATCH 1/6] mm/numa: extract the code of building node fall back list Pingfan Liu
2019-02-24 12:34 ` [PATCH 2/6] mm/memblock: make full utilization of numa info Pingfan Liu
2019-02-25 7:07 ` kbuild test robot
2019-02-25 7:59 ` kbuild test robot
2019-02-25 15:34 ` Dave Hansen
2019-02-26 5:40 ` Pingfan Liu
2019-02-26 12:37 ` Dave Hansen
2019-02-26 11:58 ` Mike Rapoport
2019-02-27 9:23 ` Pingfan Liu
2019-02-24 12:34 ` [PATCH 3/6] x86/numa: define numa_init_array() conditional on CONFIG_NUMA Pingfan Liu
2019-02-25 15:23 ` Dave Hansen
2019-02-26 5:40 ` Pingfan Liu
2019-02-24 12:34 ` Pingfan Liu [this message]
2019-02-24 12:34 ` [PATCH 5/6] x86/numa: push forward the setup of node to cpumask map Pingfan Liu
2019-02-25 15:30 ` Dave Hansen
2019-02-26 5:40 ` Pingfan Liu
2019-02-24 12:34 ` [PATCH 6/6] x86/numa: build node fallback info after setting up " Pingfan Liu
2019-02-25 16:03 ` [PATCH 0/6] make memblock allocator utilize the node's fallback info Michal Hocko
2019-02-26 5:47 ` Pingfan Liu
2019-02-26 12:09 ` Michal Hocko
2019-03-05 12:37 ` Pingfan Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1551011649-30103-5-git-send-email-kernelfans@gmail.com \
--to=kernelfans@gmail.com \
--cc=ak@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=bp@alien8.de \
--cc=corbet@lwn.net \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=luto@kernel.org \
--cc=mgorman@suse.de \
--cc=mhocko@suse.com \
--cc=mingo@redhat.com \
--cc=neelx@redhat.com \
--cc=npiggin@gmail.com \
--cc=ptesarik@suse.cz \
--cc=rppt@linux.vnet.ibm.com \
--cc=sfr@canb.auug.org.au \
--cc=tglx@linutronix.de \
--cc=vbabka@suse.cz \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).