diff options
author | David Disseldorp <ddiss@suse.de> | 2022-05-10 04:29:19 +0300 |
---|---|---|
committer | akpm <akpm@linux-foundation.org> | 2022-05-10 04:29:19 +0300 |
commit | 1274aea127b2e8c9a4b9cbcc3ea6baf78990a958 (patch) | |
tree | 7d38a30474e49396c35f49d17fc15297a9eaf485 /init/Kconfig | |
parent | fcb7aedd2e90c4ad43f7f01827014df8c6f034a5 (diff) | |
download | linux-1274aea127b2e8c9a4b9cbcc3ea6baf78990a958.tar.xz |
initramfs: add INITRAMFS_PRESERVE_MTIME Kconfig option
initramfs cpio mtime preservation, as implemented in commit 889d51a10712
("initramfs: add option to preserve mtime from initramfs cpio images"),
uses a linked list to defer directory mtime processing until after all
other items in the cpio archive have been processed. This is done to
ensure that parent directory mtimes aren't overwritten via subsequent
child creation.
The lkml link below indicates that the mtime retention use case was for
embedded devices with applications running exclusively out of initramfs,
where the 32-bit mtime value provided a rough file version identifier.
Linux distributions which discard an extracted initramfs immediately after
the root filesystem has been mounted may want to avoid the unnecessary
overhead.
This change adds a new INITRAMFS_PRESERVE_MTIME Kconfig option, which can
be used to disable on-by-default mtime retention and in turn speed up
initramfs extraction, particularly for cpio archives with large directory
counts.
Benchmarks with a one million directory cpio archive extracted 20 times
demonstrated:
mean extraction time (s) std dev
INITRAMFS_PRESERVE_MTIME=y 3.808 0.006
INITRAMFS_PRESERVE_MTIME unset 3.056 0.004
The above extraction times were measured using ftrace (initcall_finish -
initcall_start) values for populate_rootfs() with initramfs_async
disabled.
[ddiss@suse.de: rebase atop dir_entry.name flexible array member and drop separate initramfs_mtime.h header]
Link: https://lkml.org/lkml/2008/9/3/424
Link: https://lkml.kernel.org/r/20220404093429.27570-4-ddiss@suse.de
Signed-off-by: David Disseldorp <ddiss@suse.de>
Reviewed-by: Martin Wilck <mwilck@suse.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christian Brauner <christian.brauner@ubuntu.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'init/Kconfig')
-rw-r--r-- | init/Kconfig | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/init/Kconfig b/init/Kconfig index 5cddb9ba0eef..90cb1ac936db 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -1361,6 +1361,16 @@ config BOOT_CONFIG If unsure, say Y. +config INITRAMFS_PRESERVE_MTIME + bool "Preserve cpio archive mtimes in initramfs" + default y + help + Each entry in an initramfs cpio archive carries an mtime value. When + enabled, extracted cpio items take this mtime, with directory mtime + setting deferred until after creation of any child entries. + + If unsure, say Y. + choice prompt "Compiler optimization level" default CC_OPTIMIZE_FOR_PERFORMANCE |