Does limits.memory require lxcfs in order to work?

I’m a new lxd user. I got started by following the tutorial tied to the on-line demo, then installed lxd on my own machine.

Setting limits.memory for a container had no effect on the memory visible inside that container.

I had to hunt around quite a while before I found these:
Limit on cpus and memory does not work #438
lxc.cgroup.memory.limit_in_bytes has no effect on ubuntu 18.10 #2845
Will Linux/Ubuntu running in an LXC container understand cgroup memory limits?

This seems pretty basic, and it’s a common question. Check out the information callout in this Gentoo wiki page. It is hard to blame the article author for this omission, since I wasn’t able to find any mention of this in the project documentation, either.

Are the memory limits honoured, even if the new memory limit is not shown inside the container?

The limits will be enforced by the kernel but to have them be visible by userspace tools, you need lxcfs.

1 Like