bottlerocket
bottlerocket copied to clipboard
kernel-parameters settings order is not preserved
Bottlerocket isn't preserving the order of kernel parameters provided to it via settings.boot.kernel-parameters
.
For example, if I pass the following list of kernel parameters:
[settings.boot.kernel-parameters]
"hugepagesz" = [
"1G"
]
"hugepages" = [
"10"
]
What should result on the kernel command line is:
hugepagesz="1G" hugepages="10"
However, what can happen is
hugepages="10" hugepagesz="1G"
In Linux, the ordering of command line arguments can be important, and this is particularly true for Huge TLB Page configuration. The two sets of arguments above do not have the same effect: the first argument list specifies that 10 huge pages of size 1GB should be allocated; the second argument list specifies that 10 huge pages of the default size should be allocated (and the second argument is ignored). While one could argue that the order shouldn't matter, it unfortunately does matter.
So, Bottlerocket should ensure the arguments are appended to the kernel command line in the order presented in the settings. If this isn't possible with TOML, some sort of ordering hint should be possible, or perhaps these need to be an array instead of a keyed argument list.
In relevant part from the documentation (emphasis mine):
hugepages Specify the number of huge pages to preallocate. This typically follows a valid hugepagesz or default_hugepagesz parameter. However, if hugepages is the first or only hugetlb command line parameter it implicitly specifies the number of huge pages of default size to allocate.
Hi @otterley,
~Can you try specifying the parameters like so:~
[settings.boot.kernel-parameters]
"hugepagesz" = [
"1G",
"10"
]
~That should help preserve the order.~
EDIT: It's not a duplicate key issue.
Thanks for opening the issue. We'll have to take a closer look into how to go about fixing this.