From patchwork Tue Oct 25 02:59:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Leizhen (ThunderTown)" X-Patchwork-Id: 9393925 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 44EAD60231 for ; Tue, 25 Oct 2016 03:03:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 369C828ACD for ; Tue, 25 Oct 2016 03:03:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2B01F28FA5; Tue, 25 Oct 2016 03:03:20 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9E67A28ACD for ; Tue, 25 Oct 2016 03:03:19 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1byrzk-0003t7-Ki; Tue, 25 Oct 2016 03:01:44 +0000 Received: from szxga03-in.huawei.com ([119.145.14.66]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1byrzc-0003jA-PV for linux-arm-kernel@lists.infradead.org; Tue, 25 Oct 2016 03:01:39 +0000 Received: from 172.24.1.137 (EHLO szxeml428-hub.china.huawei.com) ([172.24.1.137]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id CKG05874; Tue, 25 Oct 2016 11:00:28 +0800 (CST) Received: from localhost (10.177.23.164) by szxeml428-hub.china.huawei.com (10.82.67.183) with Microsoft SMTP Server id 14.3.235.1; Tue, 25 Oct 2016 11:00:18 +0800 From: Zhen Lei To: Catalin Marinas , Will Deacon , linux-arm-kernel , linux-kernel , Andrew Morton , linux-mm Subject: [PATCH 2/2] arm64/numa: support HAVE_MEMORYLESS_NODES Date: Tue, 25 Oct 2016 10:59:18 +0800 Message-ID: <1477364358-10620-3-git-send-email-thunder.leizhen@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: <1477364358-10620-1-git-send-email-thunder.leizhen@huawei.com> References: <1477364358-10620-1-git-send-email-thunder.leizhen@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.23.164] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161024_200137_350211_87B72FF0 X-CRM114-Status: GOOD ( 13.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Xinwei Hu , Zhen Lei , Zefan Li , Hanjun Guo Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Some numa nodes may have no memory. For example: 1) a node has no memory bank plugged. 2) a node has no memory bank slots. To ensure percpu variable areas and numa control blocks of the memoryless numa nodes to be allocated from the nearest available node to improve performance, defined node_distance_ready. And make its value to be true immediately after node distances have been initialized. Signed-off-by: Zhen Lei --- arch/arm64/Kconfig | 4 ++++ arch/arm64/include/asm/numa.h | 3 +++ arch/arm64/mm/numa.c | 6 +++++- 3 files changed, 12 insertions(+), 1 deletion(-) -- 2.5.0 diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 30398db..648dd13 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -609,6 +609,10 @@ config NEED_PER_CPU_EMBED_FIRST_CHUNK def_bool y depends on NUMA +config HAVE_MEMORYLESS_NODES + def_bool y + depends on NUMA + source kernel/Kconfig.preempt source kernel/Kconfig.hz diff --git a/arch/arm64/include/asm/numa.h b/arch/arm64/include/asm/numa.h index 600887e..9d068bf 100644 --- a/arch/arm64/include/asm/numa.h +++ b/arch/arm64/include/asm/numa.h @@ -13,6 +13,9 @@ int __node_distance(int from, int to); #define node_distance(a, b) __node_distance(a, b) +extern int __initdata arch_node_distance_ready; +#define node_distance_ready() arch_node_distance_ready + extern nodemask_t numa_nodes_parsed __initdata; /* Mappings between node number and cpus on that node. */ diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c index 9a71d06..5db9765 100644 --- a/arch/arm64/mm/numa.c +++ b/arch/arm64/mm/numa.c @@ -36,6 +36,7 @@ static int cpu_to_node_map[NR_CPUS] = { [0 ... NR_CPUS-1] = NUMA_NO_NODE }; static int numa_distance_cnt; static u8 *numa_distance; static bool numa_off; +int __initdata arch_node_distance_ready; static __init int numa_parse_early_param(char *opt) { @@ -395,9 +396,12 @@ static int __init numa_init(int (*init_func)(void)) return -EINVAL; } + arch_node_distance_ready = 1; ret = numa_register_nodes(); - if (ret < 0) + if (ret < 0) { + arch_node_distance_ready = 0; return ret; + } setup_node_to_cpumask_map();