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: 79116 Delivered-To: patch@linaro.org Received: by 10.140.97.247 with SMTP id m110csp2896101qge; Mon, 24 Oct 2016 20:01:08 -0700 (PDT) X-Received: by 10.99.147.11 with SMTP id b11mr29253364pge.22.1477364468395; Mon, 24 Oct 2016 20:01:08 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p16si18449152pfj.35.2016.10.24.20.01.08; Mon, 24 Oct 2016 20:01:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758424AbcJYDA7 (ORCPT + 27 others); Mon, 24 Oct 2016 23:00:59 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:10124 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756600AbcJYDAn (ORCPT ); Mon, 24 Oct 2016 23:00:43 -0400 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 CC: Zefan Li , Xinwei Hu , Hanjun Guo , Zhen Lei 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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();