|
1 | 1 | # KEP-2570: Support Memory QoS with cgroups v2
|
2 | 2 | <!-- toc -->
|
3 | 3 | - [Release Signoff Checklist](#release-signoff-checklist)
|
| 4 | +- [Latest Update [Stalled]](#latest-update-stalled) |
4 | 5 | - [Summary](#summary)
|
5 | 6 | - [Motivation](#motivation)
|
6 | 7 | - [Goals](#goals)
|
|
65 | 66 | - [ ] User-facing documentation has been created in [kubernetes/website], for publication to [kubernetes.io]
|
66 | 67 | - [ ] Supporting documentation—e.g., additional design documents, links to mailing list discussions/SIG meetings, relevant PRs/issues, release notes
|
67 | 68 |
|
| 69 | +## Latest Update [Stalled] |
| 70 | + |
| 71 | +Work around Memory QoS has been halted because of the issues uncovered during the beta promotion process |
| 72 | +in K8s 1.28. This section is added to document the valuable lessons learned from this experience. |
| 73 | + |
| 74 | +Initial Plan: Use cgroup v2 memory.high knob to set memory throttling limit. As per the initial understanding, |
| 75 | +setting memory.high would have caused memory allocation to be slowed down once the memory usage level in the containers |
| 76 | +reached `memory.high` level. When memory usage keeps goes beyond memory.max, kernel will trigger OOM Kill. |
| 77 | + |
| 78 | +Actual Finding: According to the the [test results](https://docs.google.com/document/d/1mY0MTT34P-Eyv5G1t_Pqs4OWyIH-cg9caRKWmqYlSbI/edit?usp=sharing), it was observed that for a container process trying to allocate large chunks of memory, once the memory.high level is reached, |
| 79 | +it doesn't progress further and stays stuck indefinitely. Upon investigating further, it was observed that when memory usage |
| 80 | +within a cgroup reaches the memory.high level, the kernel initiates memory reclaim as expected. However the process gets stuck |
| 81 | +because its memory consumption rate is faster than what the memory reclaim can recover. This creates a livelock situation where |
| 82 | +the process rapidly consumes the memory reclaimed by the kernel causing the memory usage to reach memory.high level again, |
| 83 | +leading to another round of memory reclaimation by the kernel. By increasingly slowing growth in memory usage, it becomes |
| 84 | +harder and harder for workloads to reach the memory.max intervention point. (Ref: https://lkml.org/lkml/2023/6/1/1300) |
| 85 | + |
| 86 | +Future: memory.high can be used to implement kill policies in for userspace OOMs, together with [Pressure Stall Information](https://docs.kernel.org/accounting/psi.html) |
| 87 | +(PSI). When the workloads are in stuck after their memory usage levels reach memory.high, high PSI can be used by userspace OOM policy to kill such workload(s). |
| 88 | + |
| 89 | + |
68 | 90 | ## Summary
|
69 | 91 | Support memory qos with cgroups v2.
|
70 | 92 |
|
|
0 commit comments