From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike Rapoport Subject: Re: [PATCH 7/8] initramfs: proide a generic free_initrd_mem implementation Date: Wed, 13 Feb 2019 20:41:40 +0200 Message-ID: <20190213184139.GC15270@rapoport-lnx> References: <20190213174621.29297-1-hch@lst.de> <20190213174621.29297-8-hch@lst.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20190213174621.29297-8-hch@lst.de> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=m.gmane.org@lists.infradead.org To: Christoph Hellwig Cc: linux-arch@vger.kernel.org, Catalin Marinas , Will Deacon , Russell King , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Alexander Viro , Andrew Morton , Guan Xuetao , linux-arm-kernel@lists.infradead.org List-Id: linux-arch.vger.kernel.org On Wed, Feb 13, 2019 at 06:46:20PM +0100, Christoph Hellwig wrote: > For most architectures free_initrd_mem just expands to the same > free_reserved_area call. Provide that as a generic implementation > marked __weak. > > Signed-off-by: Christoph Hellwig > --- > arch/alpha/mm/init.c | 8 -------- > arch/arc/mm/init.c | 7 ------- > arch/c6x/mm/init.c | 7 ------- csky seems to open-code free_reserved_page with the only difference that it's also increments totalram_pages for the freed pages, which doesn't seem correct anyway... That said, I suppose arch/csky can be also added to the party. > arch/h8300/mm/init.c | 8 -------- > arch/m68k/mm/init.c | 7 ------- > arch/microblaze/mm/init.c | 7 ------- > arch/nds32/mm/init.c | 7 ------- > arch/nios2/mm/init.c | 7 ------- > arch/openrisc/mm/init.c | 7 ------- > arch/parisc/mm/init.c | 7 ------- > arch/powerpc/mm/mem.c | 7 ------- > arch/sh/mm/init.c | 7 ------- > arch/um/kernel/mem.c | 7 ------- > arch/unicore32/mm/init.c | 7 ------- > init/initramfs.c | 5 +++++ > 15 files changed, 5 insertions(+), 100 deletions(-) ... > diff --git a/init/initramfs.c b/init/initramfs.c > index cf8bf014873f..f3aaa58ac63d 100644 > --- a/init/initramfs.c > +++ b/init/initramfs.c > @@ -527,6 +527,11 @@ extern unsigned long __initramfs_size; > #include > #include > > +void __weak free_initrd_mem(unsigned long start, unsigned long end) > +{ > + free_reserved_area((void *)start, (void *)end, -1, "initrd"); Some architectures have pr_info("Freeing initrd memory..."), I'd add it for the generic version as well. Another thing that I was thinking of is that x86 has all those memory protection calls in its free_initrd_mem, maybe it'd make sense to have them in the generic version as well? > +} > + > #ifdef CONFIG_KEXEC_CORE > static bool kexec_free_initrd(void) > { > -- > 2.20.1 > -- Sincerely yours, Mike. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:50822 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2405540AbfBMSly (ORCPT ); Wed, 13 Feb 2019 13:41:54 -0500 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x1DId8VR039811 for ; Wed, 13 Feb 2019 13:41:52 -0500 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0b-001b2d01.pphosted.com with ESMTP id 2qmpeg72ys-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 13 Feb 2019 13:41:51 -0500 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 13 Feb 2019 18:41:50 -0000 Date: Wed, 13 Feb 2019 20:41:40 +0200 From: Mike Rapoport Subject: Re: [PATCH 7/8] initramfs: proide a generic free_initrd_mem implementation References: <20190213174621.29297-1-hch@lst.de> <20190213174621.29297-8-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190213174621.29297-8-hch@lst.de> Message-ID: <20190213184139.GC15270@rapoport-lnx> Sender: linux-arch-owner@vger.kernel.org List-ID: To: Christoph Hellwig Cc: Andrew Morton , Alexander Viro , Russell King , Catalin Marinas , Will Deacon , Guan Xuetao , linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Message-ID: <20190213184140.PsxK3EGb2aI4izlazGgXzGWtfOP6JBYz6k9Izp21NVU@z> On Wed, Feb 13, 2019 at 06:46:20PM +0100, Christoph Hellwig wrote: > For most architectures free_initrd_mem just expands to the same > free_reserved_area call. Provide that as a generic implementation > marked __weak. > > Signed-off-by: Christoph Hellwig > --- > arch/alpha/mm/init.c | 8 -------- > arch/arc/mm/init.c | 7 ------- > arch/c6x/mm/init.c | 7 ------- csky seems to open-code free_reserved_page with the only difference that it's also increments totalram_pages for the freed pages, which doesn't seem correct anyway... That said, I suppose arch/csky can be also added to the party. > arch/h8300/mm/init.c | 8 -------- > arch/m68k/mm/init.c | 7 ------- > arch/microblaze/mm/init.c | 7 ------- > arch/nds32/mm/init.c | 7 ------- > arch/nios2/mm/init.c | 7 ------- > arch/openrisc/mm/init.c | 7 ------- > arch/parisc/mm/init.c | 7 ------- > arch/powerpc/mm/mem.c | 7 ------- > arch/sh/mm/init.c | 7 ------- > arch/um/kernel/mem.c | 7 ------- > arch/unicore32/mm/init.c | 7 ------- > init/initramfs.c | 5 +++++ > 15 files changed, 5 insertions(+), 100 deletions(-) ... > diff --git a/init/initramfs.c b/init/initramfs.c > index cf8bf014873f..f3aaa58ac63d 100644 > --- a/init/initramfs.c > +++ b/init/initramfs.c > @@ -527,6 +527,11 @@ extern unsigned long __initramfs_size; > #include > #include > > +void __weak free_initrd_mem(unsigned long start, unsigned long end) > +{ > + free_reserved_area((void *)start, (void *)end, -1, "initrd"); Some architectures have pr_info("Freeing initrd memory..."), I'd add it for the generic version as well. Another thing that I was thinking of is that x86 has all those memory protection calls in its free_initrd_mem, maybe it'd make sense to have them in the generic version as well? > +} > + > #ifdef CONFIG_KEXEC_CORE > static bool kexec_free_initrd(void) > { > -- > 2.20.1 > -- Sincerely yours, Mike.