runtime: a hugepage-backed guest ignores the pod's hugepage declaration

Author: inerplatCreated Aug 7, 2026Updated Sep 29, 2026
Labelsenhancementneeds-review

Update 2026-09-22: This issue has been rewritten to reflect the current proposal in #13853; earlier revisions remain available in the edit history and comments.

Which feature do you think can be improved?

Memory sizing for hugepage-backed guests when both enable_hugepages and static_sandbox_resource_mgmt are enabled.

Kubernetes reserves guest memory through the pod's hugepages-<size> resource, but Kata does not currently use that reservation to size a static VM. The VM size and the pod's hugepage reservation are therefore independent values that operators must keep in sync.

This causes several problems:

  • If the pod reserves more than the VM uses, the remaining pages are reserved but unused.

  • If the VM is larger than the reservation, the hypervisor cannot map its memory and fails with:

    qemu-system-x86_64: unable to map backing store for guest RAM: Cannot allocate memory

    This error does not identify the mismatch between the VM size and the pod reservation.

  • Each supported guest size requires a matching runtime class or configuration override.

  • Inside the guest, a container's ordinary memory limit can prevent it from using the memory it reserved through hugepages-<size>.

The same pod can also produce different guest sizes depending on whether static sizing or memory hotplug is used.

How can it be improved?

For a static, hugetlbfs-backed VM, use the pod's reservation for the hypervisor's page size as the VM size.

The CRI does not currently carry the pod's hugepage reservation. Until it does, the runtime can read the value written by the kubelet to the pod cgroup:

hugetlb.<size>.max

The expected behavior is:

  • Size the VM from the pod's reservation for the page size used by the hypervisor.
  • Count hugepage resources added through RuntimeClass.overhead as part of that reservation.
  • Reject the sandbox before starting the hypervisor if the pod reserved none of the required page size.
  • Report the resource name and relevant sizes in the error instead of allowing the hypervisor to fail with a generic allocation error.
  • Use a container's own hugepage reservation as its memory ceiling inside the guest. A container that did not reserve huge pages keeps its ordinary memory limit.
  • Bound all containers in the sandbox together so that exceeding the guest's capacity is handled by the pod cgroup instead of the guest's global OOM killer.

default_memory remains the default for configurations where the pod does not size the VM. It should not be treated as an additional amount or as a floor once an applicable pod reservation determines the VM size.

A draft implementation is available in #13853.

Additional Information

This behavior should apply only when:

  • the guest RAM is backed by hugetlbfs;
  • static_sandbox_resource_mgmt is enabled;
  • sandbox_cgroup_only is enabled;
  • cgroup v2 is in use; and
  • the hypervisor obtains guest RAM from the hugepage pool.

Other configurations should retain their current behavior. CPU sizing and the memory hotplug path are outside the scope of this issue.

Reproduced on Kata 4.1.0 and main with the Go runtime, QEMU, cgroup v2, and boot-time 1 GiB huge pages.

Before raising this enhancement request

Have you looked at the limitations document?

  • Yes

Source: kata-containers/kata-containers