From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758294AbcJYDAm (ORCPT ); Mon, 24 Oct 2016 23:00:42 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:29414 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751689AbcJYDAk (ORCPT ); Mon, 24 Oct 2016 23:00:40 -0400 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 0/2] to support memblock near alloc and memoryless on arm64 Date: Tue, 25 Oct 2016 10:59:16 +0800 Message-ID: <1477364358-10620-1-git-send-email-thunder.leizhen@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.177.23.164] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If HAVE_MEMORYLESS_NODES is selected, and some memoryless numa nodes are actually exist. The percpu variable areas and numa control blocks of that memoryless numa nodes need to be allocated from the nearest available node to improve performance. In the beginning, I added a new function: phys_addr_t __init memblock_alloc_near_nid(phys_addr_t size, phys_addr_t align, int nid); But it can not replace memblock_virt_alloc_try_nid, because the latter can specify a min_addr, it usually be assigned as __pa(MAX_DMA_ADDRESS), to prevent memory be allocated from DMA area. It's bad to add another function, because the code will be duplicated in these two functions. So I make memblock_alloc_near_nid to be called in the subfunctions of memblock_alloc_try_nid and memblock_virt_alloc_try_nid. Add a macro node_distance_ready to distinguish different situations: 1) By default, the value of node_distance_ready is zero, memblock_*_try_nid work as normal as before. 2) ARCH platforms set the value of node_distance_ready to be true when numa node distances are ready, (please refer patch 2) memblock_*_try_nid allocate memory from the nearest node relative to the specified node. Zhen Lei (2): mm/memblock: prepare a capability to support memblock near alloc arm64/numa: support HAVE_MEMORYLESS_NODES arch/arm64/Kconfig | 4 +++ arch/arm64/include/asm/numa.h | 3 ++ arch/arm64/mm/numa.c | 6 +++- mm/memblock.c | 76 ++++++++++++++++++++++++++++++++++++------- 4 files changed, 77 insertions(+), 12 deletions(-) -- 2.5.0