From patchwork Wed Dec 26 13:14:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fengguang Wu X-Patchwork-Id: 10743135 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 65A7D91E for ; Wed, 26 Dec 2018 13:38:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 543B3204BF for ; Wed, 26 Dec 2018 13:38:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 44BA427BA5; Wed, 26 Dec 2018 13:38:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 01EC4204BF for ; Wed, 26 Dec 2018 13:38:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727010AbeLZNit (ORCPT ); Wed, 26 Dec 2018 08:38:49 -0500 Received: from mga12.intel.com ([192.55.52.136]:31979 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726959AbeLZNhG (ORCPT ); Wed, 26 Dec 2018 08:37:06 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Dec 2018 05:37:05 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,400,1539673200"; d="scan'208";a="113358931" Received: from wangdan1-mobl1.ccr.corp.intel.com (HELO wfg-t570.sh.intel.com) ([10.254.210.154]) by orsmga003.jf.intel.com with ESMTP; 26 Dec 2018 05:37:01 -0800 Received: from wfg by wfg-t570.sh.intel.com with local (Exim 4.89) (envelope-from ) id 1gc9Mr-0005O7-8z; Wed, 26 Dec 2018 21:37:01 +0800 Message-Id: <20181226133351.287359389@intel.com> User-Agent: quilt/0.65 Date: Wed, 26 Dec 2018 21:14:50 +0800 From: Fengguang Wu To: Andrew Morton cc: Linux Memory Management List , Fan Du cc: kvm@vger.kernel.org Cc: LKML cc: Yao Yuan cc: Peng Dong cc: Huang Ying CC: Liu Jingqi cc: Dong Eddie cc: Dave Hansen cc: Zhang Yi cc: Dan Williams cc: Fengguang Wu Subject: [RFC][PATCH v2 04/21] x86/numa_emulation: pass numa node type to fake nodes References: <20181226131446.330864849@intel.com> MIME-Version: 1.0 Content-Disposition: inline; filename=0021-x86-numa-Fix-fake-numa-in-uniform-case.patch Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Fan Du Signed-off-by: Fan Du --- arch/x86/mm/numa_emulation.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) --- linux.orig/arch/x86/mm/numa_emulation.c 2018-12-23 19:21:11.002206144 +0800 +++ linux/arch/x86/mm/numa_emulation.c 2018-12-23 19:21:10.998206236 +0800 @@ -12,6 +12,8 @@ static int emu_nid_to_phys[MAX_NUMNODES]; static char *emu_cmdline __initdata; +static nodemask_t emu_numa_nodes_pmem; +static nodemask_t emu_numa_nodes_dram; void __init numa_emu_cmdline(char *str) { @@ -311,6 +313,12 @@ static int __init split_nodes_size_inter min(end, limit) - start); if (ret < 0) return ret; + + /* Update numa node type for fake numa node */ + if (node_isset(i, emu_numa_nodes_pmem)) + node_set(nid - 1, numa_nodes_pmem); + else + node_set(nid - 1, numa_nodes_dram); } } return nid; @@ -410,6 +418,12 @@ void __init numa_emulation(struct numa_m unsigned long n; int nid = 0; + emu_numa_nodes_pmem = numa_nodes_pmem; + emu_numa_nodes_dram = numa_nodes_dram; + + nodes_clear(numa_nodes_pmem); + nodes_clear(numa_nodes_dram); + n = simple_strtoul(emu_cmdline, &emu_cmdline, 0); ret = -1; for_each_node_mask(i, physnode_mask) {