KEP-5759: Memory Manager Hugepages Availability Verification#5753
KEP-5759: Memory Manager Hugepages Availability Verification#5753srikalyan wants to merge 10 commits into
Conversation
This KEP proposes enhancing the Memory Manager's Static policy to verify OS-reported free hugepages availability during pod admission. Problem: The Memory Manager only tracks hugepage allocations for Guaranteed QoS pods. Burstable/BestEffort pods can consume hugepages without being tracked, causing subsequent Guaranteed pods to be admitted but fail at runtime when hugepages are exhausted. Solution: - Add FreePages field to cadvisor's HugePagesInfo (PR google/cadvisor#3804) - Verify OS-reported free hugepages during Allocate() in Static policy - Reject pods when insufficient free hugepages are available Related: kubernetes/kubernetes#134395
|
@srikalyan: The label(s) DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
Welcome @srikalyan! |
|
Hi @srikalyan. Thanks for your PR. I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/remove-area kubelet |
|
@srikalyan: Those labels are not set on the issue: DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/cc |
|
/ok-to-test |
ffromani
left a comment
There was a problem hiding this comment.
Thanks for your contribution! I'm in favor of improving the accounting and making the memory manager/kubelet more predictable. I think we can benefit from some clarifications before to deep dive into further details.
5f71eb8 to
fed79ac
Compare
Key changes: - Update milestones to v1.36/v1.37/v1.38 - Clarify sysfs reading: add GetCurrentHugepagesInfo() for fresh reads (GetMachineInfo() is cached at startup, would be stale) - Add Integration with Topology Manager section with policy behavior table - Add Interaction with CPU Manager section - Address reserved hugepages (free_hugepages is correct metric) - Expand race condition discussion with failure handling details - Rewrite Story 2 as "Rapid Pod Churn" with clear timeline - Add "Static policy only" note (None policy not applicable) - Specify error message format with example - Add kubelet restart behavior note - Update Risks table with new mitigations - Fix unit test description (removed nil reference) - Update TOC with new sections - Link enhancement issue kubernetes#5759 Related: kubernetes#5759
fed79ac to
9a89040
Compare
|
/retitle KEP-5759: Memory Manager Hugepages Availability Verification |
- Add two implementation approaches: Option A (direct sysfs) and Option B (cadvisor) - Present pros/cons for each option neutrally for KEP review - Remove cadvisor-specific sections, replace with options discussion - Add Observability section with metrics, events, logs, alerting - Update TOC to pass CI verification - Update KEP number to 5759 throughout The choice between implementation approaches is left to KEP reviewers based on maintainability preferences and timeline considerations.
c40cb0b to
8e6ae09
Compare
|
Thanks @srikalyan for leading this effort. I'm in general supportive of this memory manager enhancement and, pending further review and elaborating, I do see the benefit of the proposed approach about checking free hugepages. Because there's some time left before the 1.36 cycle begins, I'd like to explore other options to solve this problem before we commit to the proposed direction. I'll have another review iteration ASAP. |
|
@ffromani Happy new year to you. Can I request you for another review? |
ffromani
left a comment
There was a problem hiding this comment.
thanks for the updates. The next step is to bring this up on the larger sig-node and in the 1.36 SIG planning. I think this work would be well accepted by the SIG, but let's make sure.
| **Desired behavior**: The Guaranteed pod admission fails immediately with a clear | ||
| error indicating insufficient free hugepages, allowing the scheduler to try | ||
| another node or the administrator to take corrective action. |
There was a problem hiding this comment.
the alternative I'm thinking about is to extend the memory manager and admission logic to listen to each and every pod admission to track where (= which NUMA node) the hugepages are allocated from. However, If the kubelet doesn't enforce a cpuset.mems restriction, however, there's no way to know from where the hugepage is gonna be taken till the container processes go running, therefore past admission stage. Therefore, the proposed approach to check the actual free resources before each and every allocation attempt seems to be the best compromise (bar the only possible approach) in the current architecture.
We should probably document this in the "discarded alternatives" section.
How do you recommend, I approach this? |
- Add ffromani, derekwaynecarr, mrunalp as reviewers - Add dchen1107 as approver (sig-node OWNERS)
2be55a9 to
36099e3
Compare
Hi @srikalyan , sig node meeting weekly on Tuesdays at 10:00 PT (Pacific Time) so you can attend this week meeting to discuss more with SIG Node tech leads and chairs. Zoom link and detail can be viewed in here: https://github.com/kubernetes/community/tree/master/sig-node. This KEP has /lead-opted-in and /milestone v1.36 label from SIG Node for it already, so I think we will target for first deadline is Production Readiness Freeze - 4th February 2026 (AoE) / Thursday 5th February 2026, 12:00 UTC. |
|
Thank you Wendy,Will join this Tuesday.Sent from my iPhoneOn Jan 25, 2026, at 11:47 PM, Wendy Ha ***@***.***> wrote:wendy-ha18 left a comment (kubernetes/enhancements#5753)
thanks for the updates. The next step is to bring this up on the larger sig-node and in the 1.36 SIG planning. I think this work would be well accepted by the SIG, but let's make sure.
How do you recommend, I approach this?
Hi @srikalyan , sig node meeting weekly on Tuesdays at 10:00 PT (Pacific Time) so you can attend this week meeting to discuss more with SIG Node tech leads and chairs. Zoom link and detail can be viewed in here: https://github.com/kubernetes/community/tree/master/sig-node.
This KEP has /lead-opted-in and /milestone v1.36 label from SIG Node for it already, so I think we will target for first deadline is Production Readiness Freeze - 4th February 2026 (AoE) / Thursday 5th February 2026, 12:00 UTC.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
- Add haircommander (Peter Hunt) as KEP approver - Add PRR approval file for alpha stage with johnbelamaric as approver
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: srikalyan The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
FWIW: I think the need is clear and the code is pretty narrowly scoped. I am +1 on this, but we may not have TL bandwidth to get it done now |
johnbelamaric
left a comment
There was a problem hiding this comment.
One small comment otherwise PRR looks good.
@ffromani I guess this is something that will not be an issue if we use DRA for huge pages, assuming we say create each NUMA node as a device with a consumable capacity? We still need to fix this of course.
Yes, I think this is correct. We'd need to agree with the right attributes to expose, which will be an interesting discussion on its own, but the DRA model should prevent this issue completely. Elaborating a bit on the DRA side (unrelated to this PR) the initial proposal is to use the NUMA node ID as proxy to identify the memory controller and to be able to bind it to a group of CPUs. |
|
FYI, for PRR just awaiting SIG approval, I have one nit above but I consider it non-blocking. kep.yaml update does need to happen too though. |
|
Thank you all. Will address the feedback soon.Sent from my iPhoneOn Feb 11, 2026, at 11:26 AM, John Belamaric ***@***.***> wrote:johnbelamaric left a comment (kubernetes/enhancements#5753)
FYI, for PRR just awaiting SIG approval, I have one nit above but I consider it non-blocking. kep.yaml update does need to happen too though.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Co-authored-by: Wendy Ha <139814343+wendy-ha18@users.noreply.github.com>
Thank you everyone for all the feedback and I have addressed all the feedback. Let me know if you have any questions. |
- Move metrics from Beta to Alpha graduation criteria per ffromani's request to have observability available at alpha stage - Change "TBD during alpha phase" to "Will be done during alpha phase" per johnbelamaric's nit on the upgrade/rollback testing question - Add Alternative 3: Standalone NUMA-aware hugepages admission handler with pros/cons analysis per ffromani's suggestion - Expand Alternative 1 with NUMA tracking limitation: without cpuset.mems enforcement, NUMA node allocation is unknown until container runtime, making per-pod tracking infeasible at admission - Reframe race condition caveat to emphasize kubelet/workload contract breach rather than just startup failure timing - Relax milestone timeline: beta v1.38, stable v1.40 - Remove sysfs availability from risk table (sysfs is a kubelet precondition) - Recommend Option A (direct sysfs reading) with rationale - Remove feature gate as safety mechanism framing throughout - Remove hardcoded error message format (not a public API) - Remove specific log format and alerting recommendation sections - Simplify Events section to describe behavior without locking format - Move conformance tests from GA to Beta criteria - Update GA to "feature always enabled (feature gate removed)" - Reword Upgrade/Downgrade without feature gate dependency - Update rollback answer to reflect always-enabled at GA - Replace speculative discrepancy metric with alpha evaluation plan
d0147fb to
f80d3ac
Compare
Shift all milestones by one release cycle: - alpha: v1.36 → v1.37 - beta: v1.38 → v1.39 - stable: v1.40 → v1.41
- Clarify dual-source verification: min(internal_free, os_free) per NUMA node to handle both untracked Burstable pod consumption and not-yet-faulted Guaranteed pod allocations - Remove specific error message formats from KEP to avoid creating implicit API contracts - Add user-observable behavior note pointing to event reason and metrics as the stable interface for identifying verification failures
|
@ffromani need your help to get this landed in next release at least. Can you please give another shot at the review please. |
Summary
This KEP proposes enhancing the Memory Manager's Static policy to verify OS-reported free hugepages availability during pod admission.
Problem
The Memory Manager only tracks hugepage allocations for Guaranteed QoS pods. Burstable/BestEffort pods can consume hugepages (via hugetlbfs mounts or
mmapwithMAP_HUGETLB) without being tracked, causing subsequent Guaranteed pods to be admitted but fail at runtime when hugepages are exhausted.Solution
FreePagesfield toHugePagesInfowith newGetCurrentHugepagesInfo()method for fresh sysfs reads (PR: Add FreePages to HugePagesInfo for hugepage availability reporting google/cadvisor#3804)Allocate()in Static policyRelated
KEP Metadata
MemoryManagerHugepagesVerification/sig node
/kind kep