Re: [PATCH v2 6/6] RISC-V: Implement keepinitrd kernel parameter

From: Anup Patel
Date: Tue Feb 12 2019 - 05:23:37 EST


On Tue, Feb 12, 2019 at 12:38 PM Christoph Hellwig <hch@xxxxxxxxxxxxx> wrote:
>
> On Sat, Jan 19, 2019 at 01:28:59PM +0000, Anup Patel wrote:
> > This patch implements keepinitrd kernel parameter. By default,
> > keepinitrd=1 but users can pass "keepinitrd=0" to free-up
> > initrd memory at boot-time in free_initrd_mem() function.
> >
> > The keepinitrd kernel parameter is already implemented by
> > unicore32, arm, and arm64 architectures and it is documented
> > at: Documentation/admin-guide/kernel-parameters.txt
>
> But why do we need it? Is there any good reason every not to free
> the initrd / initramfs memory when it is not used?

If it is initramfs (i.e. CPIO image) then contents of CPIO archive
are extracted to create a ramfs instance.

If it is initrd (i.e. some filesystem image) then RAM block device
is created in-place at initrd location. (Please correct me if I am
wrong about initrd here).

So in case of initrd we might not want to free-up the RAM but
we can certainly free-up in case of initramfs.

Regards,
Anup