Zones allow you to limit their memory consumption. The usual way to configure this is with the zone parameter "capped-memory" and it's three sub-values "physical", "swap" and "locked". "Physical" corresponds to the resource control "zone.max-rss", which is actual main memory. "Swap" corresponds to "zone.max-swap", which is swapspace and "locked" corresponds to "zone.max-locked-memory", which is non-pageable memory, typically shared memory segments. Swap and locked memory are rather hard limits that can't be exceeded. RSS - physical memory, is not quite as hard, being enforced by rcapd. This daemon will try to page out all those memory pages that are beyond the allowed amount of memory and are least active. Depending on the activity of the processes in question, this is more or less successful, but will always result in paging activity. This will slow down the memory-hungry processes in that zone.If you change any of these values using zonecfg, these changes will only be in effect after a reboot of the zone. This is not as dynamic as one might be used to from the LDoms world. But it can be, as I'd like to show you in a small example:
Let's assume a little zone with a memory configuration like this:
root@benjaminchen:~# zonecfg -z orazone info capped-memory
To change these values while the zone is in operation, you need to interact with two different sub-systems. For physical memory, we'll need to talk to rcapd. For swap and locked memory, we need prctl for the normal resource controls. So, if I wanted to double all three limits for my zone, I'd need these commands:
root@benjaminchen:~# prctl -n zone.max-swap -v 512m -r -i zone orazone
root@benjaminchen:~# prctl -n zone.max-locked-memory -v 1g -r -i zone orazone
root@benjaminchen:~# rcapadm -z orazone -m 1g
These new values will be effective immediately - for rcapd after the next reconfigure-interval. You can also change this interval with rcapadm. Note that these changes are not persistent - if you reboot your zone, it will fall back to whatever was configured with zonecfg. So to have both - persistent changes and immediate effect, you'll need to touch both tools.