Skip to content

fix: disable Kexec Handover to free up ~128MiB of RAM - #2472

Merged
mmlb merged 2 commits into
developfrom
lowjoel/disable-kho
Sep 22, 2026
Merged

mmlb merged 2 commits into
developfrom
lowjoel/disable-kho

Conversation

@lowjoel

@lowjoel lowjoel commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

fix: disable Kexec Handover to free up ~128MiB of RAM

Required for KUBE-1370.

What is the current behavior?

On Linux 7.0 kernels kho is enabled by Ubuntu:

ubuntu@db-jrskfeoczfnalrxisytn:~$ sudo dmesg | grep -i 'cma-'
[  +0.000101] Memory: 545236K/819200K available (27136K kernel code, 6266K rwdata, 20296K rodata, 15232K init, 1301K bss, 233864K reserved, 32768K cma-reserved)

This means that we're reserving even more memory than on 6.8.0:

ubuntu@db-nfkaciskftvcorhjdwao:~$  cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-6.8.0-106-generic root=PARTUUID=6555485d-34e0-4488-9101-ad42900d9ace ro console=tty1 console=ttyAMA0
ubuntu@db-nfkaciskftvcorhjdwao:~$ sudo dmesg | grep -i 'cma-'
[    0.000000] Memory: 701468K/819200K available (23488K kernel code, 5208K rwdata, 16440K rodata, 12288K init, 1233K bss, 84964K reserved, 32768K cma-reserved)

What is the new behavior?

ubuntu@db-jrskfeoczfnalrxisytn:~$  cat /proc/cmdline
BOOT_IMAGE=/vmlinuz-7.0.0-30-generic root=PARTUUID=f257fc73-df70-4995-8eb6-953e15761105 ro console=tty1 console=ttyAMA0 kho=off panic=-1
ubuntu@db-jrskfeoczfnalrxisytn:~$  sudo dmesg | grep 'cma-'
[    0.003953] Memory: 682576K/819200K available (27136K kernel code, 6266K rwdata, 20296K rodata, 15232K init, 1301K bss, 96588K reserved, 32768K cma-reserved)

Additional context

kho reserves memory to be handed over to the kexec'ed kernel; on memory
constrained instances this is a significant amount of memory. Disable
kho since we don't use kexec to reboot anyway.

@lowjoel
lowjoel force-pushed the lowjoel/disable-kho branch 4 times, most recently from 6150fd1 to 4e4802f Compare September 21, 2026 12:53
Comment thread ansible/tasks/setup-system.yml Outdated
Comment on lines +121 to +122
when:
- qemu

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
when:
- qemu
when: qemu

but actually why not for all builds?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think we use kexec in v2; but I wanted to keep this for v3 only. If we are ok with this in v2 I can remove the restriction. Let me test that it does as it says on v3 first.

@lowjoel
lowjoel force-pushed the lowjoel/disable-kho branch from 840d91e to 85e77bf Compare September 22, 2026 00:27
lowjoel and others added 2 commits September 22, 2026 10:56
Required for KUBE-1370.

kho reserves memory to be handed over to the kexec'ed kernel; on memory
constrained instances this is a significant amount of memory. Disable
kho since we don't use kexec to reboot anyway.
@lowjoel
lowjoel force-pushed the lowjoel/disable-kho branch from 85e77bf to 861540f Compare September 22, 2026 02:56
@lowjoel

lowjoel commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor Author

OK I've tested this with 17.6.1.175-lowjoel, kho=off is set in cmdline and reserved memory is back to ~96MiB. I've removed the qemu restriction; @mmlb could you have a review please?

@lowjoel
lowjoel requested a review from mmlb September 22, 2026 02:57
@lowjoel
lowjoel marked this pull request as ready for review September 22, 2026 02:57
@lowjoel
lowjoel requested review from a team as code owners September 22, 2026 02:57
@lowjoel
lowjoel requested a lite review from Copilot September 22, 2026 02:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

No unresolved issues were identified.

Review effort: Lite
Findings: None

What changed in this PR

Disables Kexec Handover to reclaim approximately 128 MiB of RAM on constrained instances.

Changes:

  • Adds kho=off to GRUB kernel parameters.
  • Registers handlers to regenerate GRUB configuration.
File Description
ansible/​tasks/​setup-system.yml Writes the KHO-disabled GRUB configuration.
ansible/​playbook.yml Registers handler imports.
ansible/​handlers/​update-grub.yml Regenerates GRUB configuration.
ansible/​handlers/​main.yml Imports the GRUB handler.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@mmlb mmlb left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice find!

@mmlb
mmlb added this pull request to the merge queue Sep 22, 2026
Merged via the queue into develop with commit dcae072 Sep 22, 2026
73 of 75 checks passed
@mmlb
mmlb deleted the lowjoel/disable-kho branch September 22, 2026 12:42
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.

4 participants