Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot configure hugepages after bottlerocket 1.27 #4385

Open
le-duane opened this issue Feb 5, 2025 · 5 comments
Open

Cannot configure hugepages after bottlerocket 1.27 #4385

le-duane opened this issue Feb 5, 2025 · 5 comments
Labels
status/needs-triage Pending triage or re-evaluation type/bug Something isn't working

Comments

@le-duane
Copy link

le-duane commented Feb 5, 2025

Image I'm using:

Bottlerocket 1.28+ via AWS provided AMI e.g. bottlerocket-aws-k8s-1.30-x86_64-v1.32.0-cacc4ce9

What I expected to happen:

With the following configuration

[settings.boot.kernel-parameters]
"transparent_hugepage" = ["never"]
"hugepages"            = ["6550"]
"hugepagesz"           = ["2M"]

We expect 6550 huge pages are configured

What actually happened:

0 huge pages are configured

How to reproduce the problem:

Use version 1.28-1.32 of bottlerocket AMI

@le-duane le-duane added status/needs-triage Pending triage or re-evaluation type/bug Something isn't working labels Feb 5, 2025
@le-duane
Copy link
Author

le-duane commented Feb 5, 2025

Possibly related to this PR? https://github.com/bottlerocket-os/bottlerocket/pull/4290/files

@ytsssun
Copy link
Contributor

ytsssun commented Feb 5, 2025

Hi @le-duane , can you try using

[settings.kernel.sysctl]
"vm/nr_hugepages" = "6550"

@le-duane
Copy link
Author

le-duane commented Feb 5, 2025

We were considering that change, but were unsure if that was the correct direction, given there are huge-page specific settings in the 'settings.boot.kernel-parameters' section.

@ytsssun
Copy link
Contributor

ytsssun commented Feb 6, 2025

kernel-parameter theoretically can work. However, a reboot is required to apply this kernel parameter (need to set reboot-to-reconcile = true). The reason is the userdata were applied after the kernel boot (which is by design) and we will only be able to apply the kernel parameter at the second boot. This will end up with a long boot time.

At minimal you would need

[settings.boot]
reboot-to-reconcile = true

[settings.boot.kernel-parameters]
"hugepages" = [ "3521" ]

Note that, both kernel-parameters and the sysctl path would work and the end result would be the same:
/sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages will be updated. The sysctl path /proc/sys/vm/nr_hugepages will also be updated.

I would recommend using sysctl over kernel-parameters for hugepages since sysctl does not require a reboot and you can overwrite hugepage settings even after boot.

We are also aware of the issue that the setting generator we introduced recently for sysctl hugepages setting for EFA support. If you only use "vm.nr_hugepages" in the settings, and the instance does not have EFA card attached. The settings generator would try to generate a setting for "vm/nr_hugepages" with value "0". And it could clobber the hugepages value set via "vm.nr_hugepages". As a workaround, setting hugepages via "vm/nr_hugepages" is guaranteed to work.

[settings.kernel.sysctl]
"vm/nr_hugepages" = "6550"

We are working on the fix for this so that we honor the "vm.nr_hugepages" entry as well.

@le-duane
Copy link
Author

le-duane commented Feb 9, 2025

Thank you so much for the detailed feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/needs-triage Pending triage or re-evaluation type/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants