lxc not modified memory.limit_in_bytes

Bug #1166730 reported by iandriyanov
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lxc (Ubuntu)

Bug Description

This is string from config file for lxc-container
lxc.cgroup.memory.limit_in_bytes = 268435456 (256M)
lxc.cgroup.memory.memsw.limit_in_bytes = 268435456 (256M)

But! Into lxc-start vm-container and call $(free), i get out this

             total used free shared buffers cached
Mem: 2050144 1366252 683892 0 57004 1060544

Pls say, what can i wrong do? total memory on my host 2GB, and virtual container total 2G memory, and not 256M

Tags: bot-comment
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. It seems that your bug report is not filed about a specific source package though, rather it is just filed against Ubuntu in general. It is important that bug reports be filed about source packages so that people interested in the package can find the bugs about it. You can find some hints about determining what package your bug might be about at https://wiki.ubuntu.com/Bugs/FindRightPackage. You might also ask for help in the #ubuntu-bugs irc channel on Freenode.

To change the source package that this bug is filed about visit https://bugs.launchpad.net/ubuntu/+bug/1166730/+editstatus and add the package name in the text box next to the word Package.

[This is an automated message. I apologize if it reached you inappropriately; please just reply to this message indicating so.]

tags: added: bot-comment
affects: ubuntu → lxc (Ubuntu)
Revision history for this message
Stéphane Graber (stgraber) wrote :

Your configuration is valid, it's just that free and the other memory tools don't know how to check the cgroup limit.

If you try to allocate more than your limit in the container, you'll see that it'll fail as expected once it reaches the quota.

Changed in lxc (Ubuntu):
status: New → Invalid
Revision history for this message
Serge Hallyn (serge-hallyn) wrote : Re: [Bug 1166730] [NEW] lxc not modified memory.limit_in_bytes

Thanks for your question. This is definately a FAQ.

free reports information it finds in /proc/meminfo. /proc/meminfo does
not reflect cgroup-imposed restrictions.

There is a fuse-based proc overlay filesystem you can use which should
offer a filtered /proc/meminfo ( see
) however that isn't really supported.

Upstream kernel developers have so far rejected the idea of filtering
the /proc file results based on cgroup limits. It is recommended
to update the userspace applications to look at cgroup limits instead.

I will mark this bug ad affecting the kernel and mark it wishlist so
that others looking for this info can find it.

 importance: wishlist
 status: confirmed
 affects: linux
 importance: wishlist

Changed in lxc (Ubuntu):
importance: Undecided → Wishlist
status: Invalid → Confirmed
Revision history for this message
iandriyanov (iandriyanov) wrote :

If its memory using:

watch cat /sys/fs/cgroup/lxc/VM_NAME/memory.usage_in_bytes

I see that the figure does not rise above = 268435456 bytes.
BUT! I can see, into container lxc, what me available ALL host memory.
And I understand that this is not the case. After the threshold of memory not to cross. However, these figures $(free) make us think that something is not configured correctly

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

I've changed my mind, stgraber is right. Given the title of this bug, it is simply invalid.

no longer affects: linux
Changed in lxc (Ubuntu):
status: Confirmed → Invalid
Revision history for this message
iandriyanov (iandriyanov) wrote :

I'm test again. This plan:

my host (2gb total mem) - my test_container (256M total allocate mem) - switch into container and see 2gb in stout from "free" programm - run into container $(tail /dev/zero) - and see to cat /sys/fs/cgroup/lxc/VM_NAME/memory.usage_in_bytes - IT took all memory (256M) - return to host and: And I see something that began to appear on the host error that the memory is freed. Ie turns out that the insulation broken

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.