Why cgroup’s memory subsystem use oom-killer instead of return memory allocation failure when progress allow memory over cgroup limit?
Asked Answered
F

1

17

We use cgroup limit procedure use more resource。 but,when Memory is more than limit in cgroup,it will kill process。 Why cgroup’s memory subsystem use oom-killer instead of return memory allocation failure when progress allow memory over cgroup limit?

Floruit answered 12/12, 2014 at 8:50 Comment(3)
Please rephrase the question with more details if you want better response. Its best to share the cgroup conf and more details. etc.Libbylibeccio
It would be nice to know at least the following: Which kernel do you use? Do you use soft or hard memory limits? The whole cgroup config would be better though (especially if it's nontrivial). That said, the cgroup memory subsystem is not expected to kill a process unless there actually is a memory shortage (all memory and swap is used).Elva
I use 2.6.32 kernel,and use hard memeory limits。I test mysql,use up every cgroup memory。I don‘t use swap。It will oom,and oom-kill。 I hope kernel will return error,when they can't distribute page but oom-kill or hang up.Floruit
W
9

It appears that cgroups can either use oom-killer or pause the process (https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Resource_Management_Guide/sec-memory.html). But with ulimit, the allocation simply fails normally.

Some unanswered questions remain: Is there a away to get cgroups to deny the process memory (return NULL from malloc)? Or is there a way to get ulimit to deny physical memory (-m) rather than only virtual (-v)?

Waynewayolle answered 20/4, 2015 at 2:56 Comment(1)
Disabling overcommited malloc might be a way.Gallion

© 2022 - 2024 — McMap. All rights reserved.