[Lxc-users] total RAM limit
Frederic Crozat
fcrozat at suse.com
Tue Apr 23 14:14:28 UTC 2013
Le lundi 04 février 2013 à 08:38 -0600, Serge Hallyn a écrit :
> Quoting Gary Ballantyne (gary.ballantyne at haulashore.com):
> > On Fri, 1 Feb 2013 10:24:13 -0600
> > Serge Hallyn <serge.hallyn at canonical.com> wrote:
> >
> > >
> > > Did you actually test with a memory hog program? I just noticed there
> > > appears to be a bug in that if I
> > >
> > > d=/sys/fs/cgroup/memory/a
> > > mkdir $d
> > > echo 1 > $d/memory.use_hierarchy
> > > echo 5000 > $d/memory.limit_in_bytes
> > > mkdir $d/b
> > >
> > > then $d/b/memory.limit_in_bytes does not report the reduced limit. However
> > > whenI run a program which does char *c = malloc(10000) after doing
> > > echo $$ > $d/b/tasks
> > >
> > > then I get killed by OOM.
> > >
> > > -serge
> >
> > I tested with a large array in ipython. Though, from your example, it seems I'm missing memory.use_hierarchy.
> >
> > In principle, it seems like I need something like:
> >
> > echo 1 > /sys/fs/cgroup/memory/lxc/memory.use_hierarchy
> >
> > But, I can't do that before the container is started (no lxc directory) or after it is started (device busy).
> >
>
> Yup, it looks like lxc ought to set that at startup. I can think of
> absolutely no cases where we would *not* want that done. Something
> like:
>
> Subject: [PATCH 1/1] Try to enable memory cgroup use_hierarchy option.
>
> The memory cgroup has a 'memory.use_hierarchy' which is initialized to
> 0. It needs to be set to 1 at our top level, that is
> /sys/fs/cgroup/memory/lxc/memory.use_hiararchy, before we create any
> containers. After the fact is too late.
>
> Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
Any reason this patch was not pushed ?
After fixing it a bit (it was missing some directory creation and needed some massage), it works as expected on 0.8.0
and it prevents kernel warning about memcgroup use_hierarchy warning.
New version (for 0.8.0) attached.
--
Frederic Crozat <fcrozat at suse.com>
SUSE
--
Frederic Crozat <fcrozat at suse.com>
SUSE
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lxc-fix-hierarchy.patch
Type: text/x-patch
Size: 2465 bytes
Desc:
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20130423/bf356d97/attachment.bin>
More information about the lxc-users
mailing list