Can initramfs be paged out to swap disk?
EDIT: Answer updated/corrected.
Although the kernel documentation about this topic says that "Rootfs is a special instance of ramfs (or tmpfs, if that's enabled) [...]",
it is in reality still a ramfs, as a short look in the code shows (rootfs
is not mentioned in mm/shmem.c
).
Some patches (see e.g. here and here) were sent to the Linux kernel mailing list (lkml) to change this. But they were not accepted. One reason was, that you normally do not have enabled swap during the initramfs phase or in embedded systems.
The initramfs image is extracted to the rootfs. Before user space (usually switch_root
called from /init
) switches to the new root, it deletes the content of the rootfs such that only the minimal memory amount of an empty ramfs is remains. So after this, you can basically ignore its memory usage and the question if it can be swapped out, is nearly irrelevant.