Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 666
kryptosx Avatar asked Dec 12 '14 08:12

kryptosx


1 Answers

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

like image 94
joe Avatar answered Sep 22 '22 05:09

joe