Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753514AbdDKAg3 (ORCPT ); Mon, 10 Apr 2017 20:36:29 -0400 Received: from mail-pg0-f53.google.com ([74.125.83.53]:33557 "EHLO mail-pg0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752870AbdDKAg1 (ORCPT ); Mon, 10 Apr 2017 20:36:27 -0400 Date: Mon, 10 Apr 2017 17:36:25 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Wei Yang cc: kirill@shutemov.name, bp@alien8.de, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, tj@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] x86/numa_emulation: restructures numa_nodes_parsed from emulated nodes In-Reply-To: <20170410165652.50250-4-richard.weiyang@gmail.com> Message-ID: References: <20170410165652.50250-1-richard.weiyang@gmail.com> <20170410165652.50250-4-richard.weiyang@gmail.com> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1484 Lines: 38 On Tue, 11 Apr 2017, Wei Yang wrote: > By emulating numa, it may contains more or less nodes than physical nodes. > In numa_emulation(), numa_meminfo/numa_distance/__apicid_to_node is > restructured according to emulated nodes, except numa_nodes_parsed. > > This patch restructures numa_nodes_parsed from emulated nodes. > > Signed-off-by: Wei Yang Acked-by: David Rientjes although there's a small nit: NODE_MASK_NONE is only used for initialization, this should be nodes_clear(numa_nodes_parsed) instead, but that would be up to the x86 maintainers to allow it. > --- > arch/x86/mm/numa_emulation.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/arch/x86/mm/numa_emulation.c b/arch/x86/mm/numa_emulation.c > index a6d01931b9a1..14f075fc4cc5 100644 > --- a/arch/x86/mm/numa_emulation.c > +++ b/arch/x86/mm/numa_emulation.c > @@ -391,6 +391,13 @@ void __init numa_emulation(struct numa_meminfo *numa_meminfo, int numa_dist_cnt) > /* commit */ > *numa_meminfo = ei; > > + /* Make sure numa_nodes_parsed only contains emulated nodes */ > + numa_nodes_parsed = NODE_MASK_NONE; > + for (i = 0; i < ARRAY_SIZE(ei.blk); i++) > + if (ei.blk[i].start != ei.blk[i].end && > + ei.blk[i].nid != NUMA_NO_NODE) > + node_set(ei.blk[i].nid, numa_nodes_parsed); > + > /* > * Transform __apicid_to_node table to use emulated nids by > * reverse-mapping phys_nid. The maps should always exist but fall