Reserve Memory for Global Zone

We have several containers on one machine and would like to reserve some memory for the global zone. capped-memory only allows max physical/swap and setting a max on each container isn't an option. The server has 32GB physical and 30GB swap. Currently there are ten containers on it. Normally only a couple of the containers are active and consume from 10-15GB. We run into issues when a few of the containers become active or when we have a process in a container consuming all of the memory. When this happens we can't fork() in the global zone to halt the local-zone hogging the resources. Is there a way to reserve memory for the global zone so we can have enough resources to run administration commands from the global when a local-zone ends up consuming all of the memory resources?

your problem is not related to zones but to processes and memory limits in general, cannot fork will occur too if you have all processes running in one "zone" and memory is getting low. It just means the system cannot give more memory to processes. So, you need to calculate the max. needed physical memory and plug it in. Thats all.
Otherwise you will need to cap the Zone's physical memory, no way round.

(alternatively you may keep zoneadm running within Zone 0. So it should be usable, if slow)

I don't know any way to reserve memory for a zone, whether global or not. A small script using rcapstat and rcapadm that would dynamically cap your zones RAM and memory usage might answer to your issue.

yeah, but hopefully it doesn't fork processes :smiley:

If the zones are properly capped, there is no risk to have the memory exhausted so forking will still be possible.

Yeah, looks like writing a script to dynamically set/modify the "capped-memory" values is the only way. If there is a functionality to set "capped-memory" for physical and swap, you would think they would have added a "min-memory" or "reserved-memory" option.

In response to properly capping (without the use of a script that dynamically modifies the cap), it's not a proper solution for our needs.

Thanks jlliagre.

There are really only a couple of things that would stop a fork. Either you don't have the backing storage for the uninitialized stuff (stack, bss, etc) or you reached the make number of procs....