<p dir="ltr">Hi Hedi,<br>
Well, you can use disabling oom in conjunction with event handler. Thus, you can free memory by changing memory setting of other cgroups when an oom occurs in a specific cgroup, and avoid having an oops in that cgroup.<br>
You can see an example of using event handler in conjunction with disabling the oom killer in <br>
"Namespaces and cgroups in linux", in slides 101/102, see:<br>
<a href="http://ramirose.wix.com/ramirosen">http://ramirose.wix.com/ramirosen</a></p>
<p dir="ltr">A shameless plug - I wrote this presentation of 121 slides about namespaces and cgroups.</p>
<p dir="ltr">Regards,<br>
Rami Rosen<br>
</p>
<div class="gmail_quote">בתאריך 17 באפר 2014 11:24, "Hedi Boufaied" <<a href="mailto:hedi.boufaied@amadeus.com">hedi.boufaied@amadeus.com</a>> כתב:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<font face="sans-serif">Hi Rami,</font>
<br>
<br><font face="sans-serif">Thanks a lot for your sequence. I followed
it and it does work.</font>
<br><font face="sans-serif">I now see my process paused in sleep
state instead of getting killed when the cgroup reaches OoO.</font>
<br>
<br><font face="sans-serif">This being said:</font>
<br><font face="sans-serif">* I do not really understand why the
use_hierarchy option needs to be disabled in order to allow disabling of
the oom killer...</font>
<br><font face="sans-serif">* I'm not sure that disabling the OoO
killer is safe/reliable enough: in some of the trials I made, I saw other
processes (xterms) not part of the OoO cgroup getting completely stuck
and I had to reboot my machine...</font>
<br>
<br><font face="sans-serif">Best Regards,</font>
<br><font face="sans-serif">Hedi</font>
<br>
<br>
<br>
<br><font size="1" color="#5f5f5f" face="sans-serif">From:
</font><font size="1" face="sans-serif">Rami Rosen <<a href="mailto:roszenrami@gmail.com" target="_blank">roszenrami@gmail.com</a>></font>
<br><font size="1" color="#5f5f5f" face="sans-serif">To:
</font><font size="1" face="sans-serif">Hedi Boufaied <<a href="mailto:hedi.boufaied@amadeus.com" target="_blank">hedi.boufaied@amadeus.com</a>>,
</font>
<br><font size="1" color="#5f5f5f" face="sans-serif">Cc:
</font><font size="1" face="sans-serif">kernelnewbies <<a href="mailto:kernelnewbies@kernelnewbies.org" target="_blank">kernelnewbies@kernelnewbies.org</a>></font>
<br><font size="1" color="#5f5f5f" face="sans-serif">Date:
</font><font size="1" face="sans-serif">15/04/2014 15:39</font>
<br><font size="1" color="#5f5f5f" face="sans-serif">Subject:
</font><font size="1" face="sans-serif">Re: cgroups:
cannot write on file memory.oom_control</font>
<br>
<hr noshade>
<br>
<br>
<br><tt><font>Hi, Hedi,<br>
<br>
This sequence works for me:<br>
<br>
echo 0 > /sys/fs/cgroup/memory/memory.use_hierarchy<br>
<br>
mkdir /sys/fs/cgroup/memory/0<br>
<br>
Then, the following two commands changes the value of oom_kill_disable:<br>
<br>
echo 1 > /sys/fs/cgroup/memory/0/memory.oom_control<br>
<br>
echo 0 > /sys/fs/cgroup/memory/0/memory.oom_control<br>
<br>
<br>
For more info, please look for the text about enabling/disabling<br>
use_hierarchy in section 6,<br>
</font></tt><a href="http://lxr.free-electrons.com/source/Documentation/cgroups/memory.txt" target="_blank"><tt><font>http://lxr.free-electrons.com/source/Documentation/cgroups/memory.txt</font></tt></a><tt><font>.<br>
<br>
Regards,<br>
Rami Rosen<br>
</font></tt><a href="http://ramirose.wix.com/ramirosen" target="_blank"><tt><font>http://ramirose.wix.com/ramirosen</font></tt></a><tt><font><br>
<br>
<br>
<br>
On Mon, Apr 14, 2014 at 12:22 PM, Hedi Boufaied<br>
<<a href="mailto:hedi.boufaied@amadeus.com" target="_blank">hedi.boufaied@amadeus.com</a>> wrote:<br>
> Hi everyone,<br>
><br>
> I am working with cgroups on OpenSuse (over VirtualBox) and I cannot
disable<br>
> the OOM killer by writing to the file memory.oom_control:<br>
><br>
>> echo 1 > memory.oom_control<br>
>> -bash: echo: write error: Invalid argument<br>
><br>
> I can change the memory limit and several other settings by writing
to the<br>
> appropriate files (like memory.limit_in_bytes) but I could never write
to<br>
> file memory.oom_control although I am root.<br>
><br>
> I saw someone posted a similar issue a few days ago but there was
no<br>
> reply...<br>
><br>
> I have copied below the sequence of command I am using. Any idea what
could<br>
> be the issue ?<br>
><br>
> Thanks in advance for your help!<br>
><br>
> Hedi<br>
><br>
><br>
> ----<br>
><br>
> /sys/fs> su - root<br>
><br>
> /sys/fs> cd cgroup<br>
><br>
> /sys/fs/cgroup> cgcreate -g memory:/mygroup<br>
><br>
> /sys/fs/cgroup> cd memory/mygroup<br>
><br>
> /sys/fs/cgroup/memory/mygroup> echo 32M > memory.limit_in_bytes<br>
><br>
> /sys/fs/cgroup/memory/mygroup> cat memory.limit_in_bytes<br>
> 33554432<br>
><br>
> /sys/fs/cgroup/memory/mygroup> echo 1 > memory.oom_control<br>
> -bash: echo: write error: Invalid argument<br>
><br>
> /sys/fs/cgroup/memory/mygroup> cat memory.oom_control<br>
> oom_kill_disable 0<br>
> under_oom 0<br>
><br>
> ---<br>
> _______________________________________________<br>
> Kernelnewbies mailing list<br>
> <a href="mailto:Kernelnewbies@kernelnewbies.org" target="_blank">Kernelnewbies@kernelnewbies.org</a><br>
> </font></tt><a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank"><tt><font>http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</font></tt></a><tt><font><br>
><br>
</font></tt>
<br></blockquote></div>