Skip to content

Conversation

@licliu
Copy link
Collaborator

@licliu licliu commented Dec 4, 2025

Starting with Linux 6.18, Fedora 42, RHEL 10.2, and RHEL 9.8, the kernel supports the initramfs_options boot parameter.

Sets initramfs_options=size=90% can increase the size of the tmpfs used for initramfs decompression from the default 50% to 90% of memory.

This change greatly reduces memory pressure during decompression, allowing for a reduction in the memory reserved for the crashkernel.

Starting with Linux 6.18, Fedora 42, RHEL 10.2, and RHEL 9.8, the
kernel supports the `initramfs_options` boot parameter.

Sets `initramfs_options=size=90%` can increase the size of the tmpfs
used for initramfs decompression from the default 50% to 90% of memory.

This change greatly reduces memory pressure during decompression,
allowing for a reduction in the memory reserved for the crashkernel.

Signed-off-by: Lichen Liu <lichliu@redhat.com>
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @licliu, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request optimizes system memory usage during the boot process by leveraging the new initramfs_options kernel parameter. By increasing the temporary filesystem size for initramfs decompression, it alleviates memory pressure, ultimately contributing to more efficient memory allocation for critical system components like the crashkernel.

Highlights

  • New Kernel Boot Parameter: Introduces the initramfs_options boot parameter, supported by Linux 6.18 and newer distributions like Fedora 42, RHEL 10.2, and RHEL 9.8.
  • Memory Optimization: Sets initramfs_options=size=90% across all architectures in the KDUMP_COMMANDLINE_APPEND array, increasing the tmpfs size for initramfs decompression from the default 50% to 90% of memory.
  • Reduced Memory Pressure: This change significantly reduces memory pressure during initramfs decompression, which in turn allows for a potential reduction in the memory reserved for the crashkernel.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds the initramfs_options=size=90% kernel parameter to reduce memory pressure during kdump initramfs decompression. This is a good improvement for systems with newer kernels.

However, there are a couple of issues to consider:

  1. Incorrect Memory Estimation: The do_estimate function in kdumpctl calculates the recommended crashkernel memory. It contains logic based on the default 50% tmpfs size for initramfs. With your change to 90%, this estimation is no longer accurate and will recommend a much larger memory size than necessary, which counteracts the goal of this PR. The calculation in kdumpctl (line 1610) should be updated to reflect the new tmpfs size. Based on the existing formulas in the code, the multiplier for initrd_size should probably change from 3 to approximately 2.11 (which is 1 + 1/0.9).

  2. Unconditional Parameter: The initramfs_options parameter is added unconditionally. According to the PR description, this is only supported on kernels 6.18 and newer. While older kernels will likely ignore this parameter, it would be cleaner to add it conditionally in kdumpctl based on the kernel version. This would also allow the do_estimate function to adjust its calculation based on whether the option is actually being used.

Addressing these points would make the change more robust and fully achieve the goal of optimizing memory usage.

Comment on lines +28 to +34
[default]="irqpoll maxcpus=1 reset_devices novmcoredd cma=0 hugetlb_cma=0 initramfs_options=size=90%"
[aarch64]="irqpoll nr_cpus=1 reset_devices cgroup_disable=memory udev.children-max=2 panic=10 swiotlb=noforce novmcoredd cma=0 hugetlb_cma=0 kfence.sample_interval=0 initramfs_options=size=90%"
[i386]="irqpoll nr_cpus=1 reset_devices numa=off udev.children-max=2 panic=10 transparent_hugepage=never novmcoredd cma=0 hugetlb_cma=0 kfence.sample_interval=0 initramfs_options=size=90%"
[ppc64]="irqpoll maxcpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 kvm_cma_resv_ratio=0 transparent_hugepage=never novmcoredd hugetlb_cma=0 kfence.sample_interval=0 initramfs_options=size=90%"
[ppc64le]="irqpoll nr_cpus=1 noirqdistrib reset_devices cgroup_disable=memory numa=off udev.children-max=2 ehea.use_mcs=0 panic=10 kvm_cma_resv_ratio=0 transparent_hugepage=never novmcoredd hugetlb_cma=0 kfence.sample_interval=0 initramfs_options=size=90%"
[s390x]="nr_cpus=1 cgroup_disable=memory numa=off udev.children-max=2 panic=10 transparent_hugepage=never novmcoredd vmcp_cma=0 cma=0 hugetlb_cma=0 kfence.sample_interval=0 initramfs_options=size=90%"
[x86_64]="irqpoll nr_cpus=1 reset_devices cgroup_disable=memory mce=off numa=off udev.children-max=2 panic=10 acpi_no_memhotplug transparent_hugepage=never nokaslr hest_disable novmcoredd cma=0 hugetlb_cma=0 pcie_ports=compat kfence.sample_interval=0 initramfs_options=size=90%"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The option initramfs_options=size=90% is repeated for every architecture. This creates code duplication and makes future maintenance harder. If this value needs to be changed, it will have to be updated in 7 different places, which is error-prone.

To improve maintainability, you could define this option in a variable and append it programmatically to all entries. For example, you could add a loop after the array definition:

INITRAMFS_OPTS=" initramfs_options=size=90%"
for arch in "${!KDUMP_COMMANDLINE_APPEND[@]}"; do
    KDUMP_COMMANDLINE_APPEND[$arch]+=$INITRAMFS_OPTS
done

This would centralize the option and make the code cleaner and easier to manage.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @licliu, to further extend Gemini's idea, how about extracting all values shared by all architectures (something like this commit)? If you think it's a good idea, I will create a PR and address this feedback in that PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @coiby, I think that's great.

@licliu
Copy link
Collaborator Author

licliu commented Dec 4, 2025

The older kernels will ignore this option so I think it will not be a big problem.
For do_estimate(), I plan to change it next version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants