This question comes from my curiosity about how Kubernetes handles resource requests and limits, especially memory constraints defined for pods.
I understand that Kubernetes uses cgroups under the hood to enforce these limits, and I'm trying to dig deeper into what actually happens at the kernel level when a process inside a cgroup exceeds its memory limit (memory.max, in cgroups v2).
Specifically, I'm wondering:
- What criteria does the Linux kernel use to decide whether to deny a memory allocation versus triggering the OOM killer?
- Is there a threshold or condition that determines which action is taken?
I'm exploring this in the context of containerized workloads (e.g., Kubernetes pods), but I'm interested in the general kernel behavior regardless of orchestration.
Thanks in advance!