[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1545299439-31370-4-git-send-email-kernelfans@gmail.com>
Date: Thu, 20 Dec 2018 17:50:39 +0800
From: Pingfan Liu <kernelfans@...il.com>
To: linux-mm@...ck.org
Cc: Pingfan Liu <kernelfans@...il.com>, linuxppc-dev@...ts.ozlabs.org,
x86@...nel.org, linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Michal Hocko <mhocko@...e.com>,
Vlastimil Babka <vbabka@...e.cz>,
Mike Rapoport <rppt@...ux.vnet.ibm.com>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
David Rientjes <rientjes@...gle.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Michael Ellerman <mpe@...erman.id.au>
Subject: [PATCHv2 3/3] powerpc/numa: make all possible node be instanced against NULL reference in node_zonelist()
This patch tries to resolve a bug rooted at mm when using nr_cpus. It was
reported at [1]. The root cause is: device->numa_node info is used as
preferred_nid param for __alloc_pages_nodemask(), which causes NULL
reference when ac->zonelist = node_zonelist(preferred_nid, gfp_mask), due to
the preferred_nid is not online and not instanced. Hence the bug affects
all archs if a machine having a memory less numa-node, but a device on the
node is used and provide numa_node info to __alloc_pages_nodemask().
This patch makes all possible node online for ppc.
[1]: https://lore.kernel.org/patchwork/patch/1020838/
Signed-off-by: Pingfan Liu <kernelfans@...il.com>
Cc: linuxppc-dev@...ts.ozlabs.org
Cc: x86@...nel.org
Cc: linux-kernel@...r.kernel.org
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Michal Hocko <mhocko@...e.com>
Cc: Vlastimil Babka <vbabka@...e.cz>
Cc: Mike Rapoport <rppt@...ux.vnet.ibm.com>
Cc: Bjorn Helgaas <bhelgaas@...gle.com>
Cc: Jonathan Cameron <Jonathan.Cameron@...wei.com>
Cc: David Rientjes <rientjes@...gle.com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Ingo Molnar <mingo@...hat.com>
Cc: Borislav Petkov <bp@...en8.de>
Cc: "H. Peter Anvin" <hpa@...or.com>
Cc: Benjamin Herrenschmidt <benh@...nel.crashing.org>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Michael Ellerman <mpe@...erman.id.au>
---
Note:
[1-2/3] implements one way to fix the bug, while this patch tries another way.
Hence using this patch when [1-2/3] is not acceptable.
arch/powerpc/mm/numa.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index ce28ae5..31d81a4 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -864,10 +864,19 @@ void __init initmem_init(void)
memblock_dump_all();
- for_each_online_node(nid) {
+ /* Instance all possible nodes to overcome potential NULL reference
+ * issue on node_zonelist() when using nr_cpus
+ */
+ for_each_node(nid) {
unsigned long start_pfn, end_pfn;
- get_pfn_range_for_nid(nid, &start_pfn, &end_pfn);
+ if (node_online(nid))
+ get_pfn_range_for_nid(nid, &start_pfn, &end_pfn);
+ else {
+ start_pfn = end_pfn = 0;
+ /* online it, so later zonelists[] will be built */
+ node_set_online(nid);
+ }
setup_node_data(nid, start_pfn, end_pfn);
sparse_memory_present_with_active_regions(nid);
}
--
2.7.4
Powered by blists - more mailing lists