Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753586AbcDKLRz (ORCPT ); Mon, 11 Apr 2016 07:17:55 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:8161 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753411AbcDKLRy (ORCPT ); Mon, 11 Apr 2016 07:17:54 -0400 Message-ID: <570B85B6.8000805@huawei.com> Date: Mon, 11 Apr 2016 19:08:38 +0800 From: Xishi Qiu User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Chen Feng CC: , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH 2/2] arm64: mm: make pfn always valid with flat memory References: <1459844572-53069-1-git-send-email-puck.chen@hisilicon.com> <1459844572-53069-2-git-send-email-puck.chen@hisilicon.com> In-Reply-To: <1459844572-53069-2-git-send-email-puck.chen@hisilicon.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.25.179] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020201.570B85DA.0033,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: b27b62c7db7cad49d9e794efa90e4511 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1384 Lines: 48 On 2016/4/5 16:22, Chen Feng wrote: > Make the pfn always valid when using flat memory. > If the reserved memory is not align to memblock-size, > there will be holes in zone. > > This patch makes the memory in buddy always in the > array of mem-map. > > Signed-off-by: Chen Feng > Signed-off-by: Fu Jun > --- > arch/arm64/mm/init.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c > index ea989d8..0e1d5b7 100644 > --- a/arch/arm64/mm/init.c > +++ b/arch/arm64/mm/init.c > @@ -306,7 +306,8 @@ static void __init free_unused_memmap(void) How about let free_unused_memmap() support for CONFIG_SPARSEMEM_VMEMMAP? Thanks, Xishi Qiu > struct memblock_region *reg; > > for_each_memblock(memory, reg) { > - start = __phys_to_pfn(reg->base); > + start = round_down(__phys_to_pfn(reg->base), > + MAX_ORDER_NR_PAGES); > > #ifdef CONFIG_SPARSEMEM > /* > @@ -327,8 +328,8 @@ static void __init free_unused_memmap(void) > * memmap entries are valid from the bank end aligned to > * MAX_ORDER_NR_PAGES. > */ > - prev_end = ALIGN(__phys_to_pfn(reg->base + reg->size), > - MAX_ORDER_NR_PAGES); > + prev_end = round_up(__phys_to_pfn(reg->base + reg->size), > + MAX_ORDER_NR_PAGES); > } > > #ifdef CONFIG_SPARSEMEM