Never touched virtual memory should normally have virtually zero real memory footprint. Or am I mistaken?
-j
On Wed, Apr 10, 2013 at 9:27 AM, Kyle Lemons <kev...@google.com> wrote:Afraid not, I and my colleagues looked into (and experimented with)
> Can you use cgroups to apply the limits you want to the applications for
> which you need such limits? It seems to me that disabling overcommit would
> be akin to cutting a carrot with a bandsaw. Sure, it works, but there are
> much more precise tools available.
>
> https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/Documentation/cgroups/cgroups.txt?id=refs/tags/v3.8.6
many cgroups details very closely. This would be the ideal solution,
because the number of programs that want to deal with ENOMEM is but a
dwindling number.
The reason being at least as of 3.2 (and apparently as of 3.8) as well
memcg does not track virtual memory use in each container, so
overcommit off does something almost like nothing: the moment a
process in the container causes a page fault that would increase the
container's memory usage (not charge) beyond a certain amount, the OOM
killer is invoked. The only time overcommit off has the desired
effect is if the whole system was going to run out of available commit
charge anyway (i.e. memcg works on entirely orthogonal grounds).
I haven't quite poked the linux-mm list just yet, but talking to a few
people familiar with the matter suggest that adding virtual memory
tracking to memcg is not going to be easy to finesse on LKML.
The process runs afoul the memcg memory limit by writing to memory.
Once too much memory use is incurred it is lights out (or, a stall
in newer versions of memcg if configured just right). The stalling
option is helpful for writing your own OOM-killer if you are
unsatisfied with Linux's, but not very helpful to programs that can
deal with ENOMEM: presumably, they want to do some clean-up that does
not require additional allocations so that other actors can continue
to function normally (e.g. Postgres: releasing locks).
So, regrettably, memcg is not a very viable looking workaround as it
exists today, although I think with a VM-constrained mode it'd be
pretty close to ideal: systems designed to cope with full reservation
of VMA can live in that world, and the rest of the world that can't
justify caring about that can exist under overcommit regimes, all on
the same running kernel.