On 12/19/23 20:19, Askar Safin wrote:
On Sun, Nov 19, 2023 at 08:12:48PM -0500, Stefan Berger wrote:
Documentation/filesystems/ramfs-rootfs-initramfs.rst states:
If CONFIG_TMPFS is enabled, rootfs will use tmpfs instead of ramfs by default. To force ramfs, add "rootfstype=ramfs" to the kernel command line.
I wrote that around 2005.
This currently does not work when root= is provided since then saved_root_name contains a string and rootfstype= is ignored.
I wrote the code to populate a tmpfs from initramfs in 2013 (8 years later), because nobody else had bothered to, and I've had a patch to fix the rootfstype= issue for years, but I long ago lost my touch with linux-kernel proctology:
https://lkml.iu.edu/hypermail/linux/kernel/2302.2/05601.html
Last I heard it was going upstream via somebody else (who tripled the size of the fix for no obvious reason, but that's modern linux-kernel for you), but I lost track after the guy who'd said to send it to him instead did multiple automated bounces from a bot that said "to save this one special guy's time, we're going to spam linux-kernel with autogenerated content delivered to tens of thousands of plebian mailboxes":
https://lkml.iu.edu/hypermail/linux/kernel/2311.1/05544.html https://lkml.iu.edu/hypermail/linux/kernel/2311.1/06448.html
Last I saw the rewrite of the fix had been resubmitted to the Special Guy a fourth time:
https://lkml.iu.edu/hypermail/linux/kernel/2311.2/02938.html
Maybe it'll show up in a git pull someday? Who knows...
Therefore,
ramfs is currently always chosen when root= is provided.
Maybe it is a good idea to just fully remove ramfs?
"Let's delete a 20 year old filesystem that's been built into every system that whole time, this can't POSSIBLY have any side effects."
We've already discussed this, more than once:
https://lkml.iu.edu/hypermail/linux/kernel/2311.0/00435.html
Can you build tmpfs on a nommu system? Last I checked the plumbing expects swap, but it's been a while...
initramfs will always be tmpfs. And tmpfs will always be enabled.
As well as I understand, ramfs was originally introduced, because tmpfs seemed too big.
No, ramfs came first, tmpfs was created later. Not just what initramfs uses, but the order in which the filesystems were written.
I believe modern ramfs more or less dates to Al Viro factoring out "libfs":
https://lwn.net/Articles/57369/
Although the memory grows a bit hazy. (I vaguely remember what happened, but exactly when it was, and what came before what... git log in my unified history tree is showing fs/ramfs originating from 2.3.99pre4 in 2000 but it may be confused by a rename. I remember somebody, I thought Linus, saying that ramfs was an example user of the libfs code...)
Here are my configs (x86_64). Just enough to run busybox in "qemu -serial stdio"
Back when I maintained busybox there were people in that space who cared about 14k, and that's not measuring runtime overhead.
There was a lovely ELC talk in 2015 about booting Linux in 256 kilobytes of SRAM (everything else being XIP out of ROM-alikes), but alas the entire year's videos got wiped by the Linux Foundation. The PDF is still online though:
https://elinux.org/images/9/90/Linux_for_Microcontrollers-_From_Marginal_to_...
Alas, XIP got replaced with DAX which I've never managed to get to work...
Rob