From mboxrd@z Thu Jan 1 00:00:00 1970 From: puck.chen@hisilicon.com (Chen Feng) Date: Thu, 7 Apr 2016 15:39:03 +0800 Subject: [PATCH 2/2] arm64: mm: make pfn always valid with flat memory In-Reply-To: <1459844572-53069-2-git-send-email-puck.chen@hisilicon.com> References: <1459844572-53069-1-git-send-email-puck.chen@hisilicon.com> <1459844572-53069-2-git-send-email-puck.chen@hisilicon.com> Message-ID: <57060E97.7060101@hisilicon.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org add Mel Gorman 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) > 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 > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi0-f52.google.com (mail-oi0-f52.google.com [209.85.218.52]) by kanga.kvack.org (Postfix) with ESMTP id 1CDD56B0005 for ; Thu, 7 Apr 2016 03:41:28 -0400 (EDT) Received: by mail-oi0-f52.google.com with SMTP id p188so88801823oih.2 for ; Thu, 07 Apr 2016 00:41:28 -0700 (PDT) Received: from szxga03-in.huawei.com (szxga03-in.huawei.com. [119.145.14.66]) by mx.google.com with ESMTP id h16si2345702oig.64.2016.04.07.00.41.25 for ; Thu, 07 Apr 2016 00:41:27 -0700 (PDT) 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> From: Chen Feng Message-ID: <57060E97.7060101@hisilicon.com> Date: Thu, 7 Apr 2016 15:39:03 +0800 MIME-Version: 1.0 In-Reply-To: <1459844572-53069-2-git-send-email-puck.chen@hisilicon.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: catalin.marinas@arm.com, will.deacon@arm.com, ard.biesheuvel@linaro.org, mark.rutland@arm.com, akpm@linux-foundation.org, robin.murphy@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, mhocko@suse.com, kirill.shutemov@linux.intel.com, rientjes@google.com, linux-mm@kvack.org, mgorman@suse.de Cc: puck.chen@foxmail.com, oliver.fu@hisilicon.com, linuxarm@huawei.com, dan.zhao@hisilicon.com, suzhuangluan@hisilicon.com, yudongbin@hislicon.com, albert.lubing@hisilicon.com, xuyiping@hisilicon.com, saberlily.xia@hisilicon.com add Mel Gorman 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) > 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 > -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755337AbcDGHkk (ORCPT ); Thu, 7 Apr 2016 03:40:40 -0400 Received: from szxga03-in.huawei.com ([119.145.14.66]:24611 "EHLO szxga03-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751426AbcDGHkj (ORCPT ); Thu, 7 Apr 2016 03:40:39 -0400 Subject: Re: [PATCH 2/2] arm64: mm: make pfn always valid with flat memory To: , , , , , , , , , , , , References: <1459844572-53069-1-git-send-email-puck.chen@hisilicon.com> <1459844572-53069-2-git-send-email-puck.chen@hisilicon.com> CC: , , , , , , , , From: Chen Feng Message-ID: <57060E97.7060101@hisilicon.com> Date: Thu, 7 Apr 2016 15:39:03 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.1 MIME-Version: 1.0 In-Reply-To: <1459844572-53069-2-git-send-email-puck.chen@hisilicon.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.142.193.64] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090205.57060EA3.001B,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2013-05-26 15:14:31, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: ab091eb86f91452ad9cf2fed0dbc296f Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org add Mel Gorman 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) > 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 >