cgroups: cannot write on file memory.oom_control

Rami Rosen roszenrami at gmail.com
Fri Apr 18 16:36:27 EDT 2014


Hi Hedi,
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.
You can see an example of using event handler in conjunction with disabling
the oom killer in
"Namespaces and cgroups in linux", in slides 101/102, see:
http://ramirose.wix.com/ramirosen

A shameless plug - I wrote this presentation of 121 slides about namespaces
and cgroups.

Regards,
Rami Rosen
 בתאריך 17 באפר 2014 11:24, "Hedi Boufaied" <hedi.boufaied at amadeus.com> כתב:

> Hi Rami,
>
> Thanks a lot for your sequence. I followed it and it does work.
> I now see my process paused in sleep state instead of getting killed when
> the cgroup reaches OoO.
>
> This being said:
> * I do not really understand why the use_hierarchy option needs to be
> disabled in order to allow disabling of the oom killer...
> * 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...
>
> Best Regards,
> Hedi
>
>
>
> From:        Rami Rosen <roszenrami at gmail.com>
> To:        Hedi Boufaied <hedi.boufaied at amadeus.com>,
> Cc:        kernelnewbies <kernelnewbies at kernelnewbies.org>
> Date:        15/04/2014 15:39
> Subject:        Re: cgroups: cannot write on file memory.oom_control
> ------------------------------
>
>
>
> Hi, Hedi,
>
> This sequence works for me:
>
> echo 0 >  /sys/fs/cgroup/memory/memory.use_hierarchy
>
> mkdir  /sys/fs/cgroup/memory/0
>
> Then, the following two commands changes the value of oom_kill_disable:
>
> echo 1 >   /sys/fs/cgroup/memory/0/memory.oom_control
>
> echo 0 >   /sys/fs/cgroup/memory/0/memory.oom_control
>
>
> For more info, please look for the text about enabling/disabling
> use_hierarchy in section 6,
> http://lxr.free-electrons.com/source/Documentation/cgroups/memory.txt.
>
> Regards,
> Rami Rosen
> http://ramirose.wix.com/ramirosen
>
>
>
> On Mon, Apr 14, 2014 at 12:22 PM, Hedi Boufaied
> <hedi.boufaied at amadeus.com> wrote:
> > Hi everyone,
> >
> > I am working with cgroups on OpenSuse (over VirtualBox) and I cannot
> disable
> > the OOM killer by writing to the file memory.oom_control:
> >
> >> echo 1 > memory.oom_control
> >> -bash: echo: write error: Invalid argument
> >
> > I can change the memory limit and several other settings by writing to
> the
> > appropriate files (like memory.limit_in_bytes) but I could never write to
> > file memory.oom_control although I am root.
> >
> > I saw someone posted a similar issue a few days ago but there was no
> > reply...
> >
> > I have copied below the sequence of command I am using. Any idea what
> could
> > be the issue ?
> >
> > Thanks in advance for your help!
> >
> > Hedi
> >
> >
> > ----
> >
> > /sys/fs> su - root
> >
> > /sys/fs> cd cgroup
> >
> > /sys/fs/cgroup> cgcreate -g memory:/mygroup
> >
> > /sys/fs/cgroup> cd memory/mygroup
> >
> > /sys/fs/cgroup/memory/mygroup> echo 32M > memory.limit_in_bytes
> >
> > /sys/fs/cgroup/memory/mygroup> cat memory.limit_in_bytes
> > 33554432
> >
> > /sys/fs/cgroup/memory/mygroup> echo 1 > memory.oom_control
> > -bash: echo: write error: Invalid argument
> >
> > /sys/fs/cgroup/memory/mygroup> cat memory.oom_control
> > oom_kill_disable 0
> > under_oom 0
> >
> > ---
> > _______________________________________________
> > Kernelnewbies mailing list
> > Kernelnewbies at kernelnewbies.org
> > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140418/821d84f7/attachment.html 


More information about the Kernelnewbies mailing list