Re: Is initramfs freed after kernel is booted?

From: Kevin P. Fleming
Date: Mon Nov 17 2003 - 10:49:01 EST


Chris Friesen wrote:

Absolutely, the memory should be reclaimed. I would have thought that you could just unmount it--if the pivot_root is done properly there shouldn't be any references left to the initramfs.

There is no pivot_root happening here; the kernel creates a ramfs and mounts it on / (as rootfs), then unpacks the initramfs cpio archive into it. After doing a few more steps, it overmounts the real root onto /, making the rootfs filesystem invisible. It is not freed in the current kernels.

I suspect that if you wanted to modify init/do_mounts.c, you could use the initrd technique of doing the pivot_root yourself (instead of letting the kernel automount the "real" root filesystem), at which point it maybe be possible to umount and free the rootfs.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/