On 2023/12/12 15:35, Christoph Hellwig wrote:
On Tue, Dec 12, 2023 at 08:50:56AM +0800, Gao Xiang wrote:
For non-virtualization cases, I guess you could try to use `memmap`
kernel option [2] to specify a memory region by bootloaders which
contains an EROFS rootfs and a customized init for booting as
erofs+overlayfs at least for `initoverlayfs`. The main benefit is
that the memory region specified by the bootloader can be directly
used for mounting. But I never tried if this option actually works.
Furthermore, compared to traditional ramdisks, using direct address
can avoid page cache totally for uncompressed files like it can
just use unencoded data as mmaped memory. For compressed files, it
still needs page cache to support mmaped access but we could adapt
more for persistent memory scenarios such as disable cache
decompression compared to previous block devices.
I'm not sure if it's worth implementing this in kernelspace since
it's out of scope of an individual filesystem anyway.
IFF the use case turns out to be generally useful (it looks quite
convoluted and odd to me), we could esily do an initdax concept where
a chunk of memory passed by the bootloader is presented as a DAX device
properly without memmap hacks.
I have no idea how it's faster than the current initramfs or initrd.
So if it's really useful, maybe some numbers can be posted first
with the current `memmap` hack and see it's worth going further with
some new infrastructure like initdax.
Thanks,
Gao Xiang