16

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?

3
  • Please rephrase the question with more details if you want better response. Its best to share the cgroup conf and more details. etc.
    – askb
    Dec 12, 2014 at 11:17
  • 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).
    – marbu
    Jan 22, 2015 at 15:50
  • 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.
    – kryptosx
    Jan 29, 2015 at 9:44

1 Answer 1

8

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)?

1
  • Disabling overcommited malloc might be a way. Jul 14, 2020 at 16:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.