From: David Disseldorp <ddiss@suse.de>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org, Christian Brauner <brauner@kernel.org>
Subject: Re: [RFC PATCH 0/6] initramfs: reduce buffer footprint
Date: Wed, 16 Oct 2024 02:42:09 +0000 [thread overview]
Message-ID: <20241016024209.7c655763.ddiss@suse.de> (raw)
In-Reply-To: <20241015233415.GG4017910@ZenIV>
On Wed, 16 Oct 2024 00:34:15 +0100, Al Viro wrote:
> On Tue, Oct 15, 2024 at 01:11:57PM +0000, David Disseldorp wrote:
> > There are a number of stack, heap and data-segment buffers which are
> > unnecessary for initramfs unpacking. This patchset attempts to remove
> > them by:
> > - parsing cpio hex strings in place, instead of copying them for
> > nul-termination. (Patches 1 & 2).
> > - reusing a single heap buffer for cpio header, file and symlink paths,
> > instead of three separate buffers. (Patches 3 & 4).
> > - reusing the heap-allocated cpio buffer across both builtin and
> > bootloader-provided unpack attempts. (Patch 5).
> > - reusing the heap-allocated cpio buffer for error messages on
> > FSM-exit, instead of a data-segment buffer. (Patch 6).
> >
> > I've flagged this as an RFC as I'd like to improve the commit messages
> > and also provide more thorough testing, likely via kunit / kselftest
> > integration.
>
> Umm... An obvious question: what's the point? Reducing the amount of
> temporary allocations (and not particularly large ones, at that) done
> during early boot and freed before we run anything in user mode?
"reduce buffer footprint" is a bad title... My initial motivation was to
improve initramfs unpack error reporting (still WIP), following a
downstream bug report.
Patches 1 & 2 avoid 13 memcpy() calls for every initramfs entry and IMO
leave the code more readable, so should be justified once I have
profiling data.
Patches 3-5 remove five extra kmalloc() calls when booting with built-in
and bootloader initramfses. I doubt it'll be visible in profiling, but
they allow for buffer reuse for dynamic error messages instead of
sprinkling data-segment buffers around, like the one removed in patch 6.
prev parent reply other threads:[~2024-10-16 2:42 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-15 13:11 [RFC PATCH 0/6] initramfs: reduce buffer footprint David Disseldorp
2024-10-15 13:11 ` [RFC PATCH 1/6] vsprintf: add simple_strntoul David Disseldorp
2024-10-15 13:11 ` [RFC PATCH 2/6] initramfs: avoid memcpy for hex header fields David Disseldorp
2024-10-15 13:12 ` [RFC PATCH 3/6] initramfs: remove extra symlink path buffer David Disseldorp
2024-10-15 13:12 ` [RFC PATCH 4/6] initramfs: merge header_buf and name_buf David Disseldorp
2024-10-15 13:12 ` [RFC PATCH 5/6] initramfs: reuse buf for built-in and bootloader initramfs David Disseldorp
2024-10-15 13:12 ` [RFC PATCH 6/6] initramfs: avoid static buffer for error message David Disseldorp
2024-10-15 23:34 ` [RFC PATCH 0/6] initramfs: reduce buffer footprint Al Viro
2024-10-16 2:42 ` David Disseldorp [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241016024209.7c655763.ddiss@suse.de \
--to=ddiss@suse.de \
--cc=brauner@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).