Memory Reservation Pools for Kernel Zones
Oracle Solaris introduces memory resource pools (MRP) that can reserve system memory for use by kernel zones.
By default, Oracle Solaris global zones allocate memory for kernel zones from available system memory when a kernel zone boots. A kernel zone fails to boot if insufficient memory is available.
The recommended configuration uses an MRP to reserve memory for all kernel zones that are required to run in your production environment.
The MRP service management facility (SMF) service reserves memory for kernel zones. The reservation occurs early in the boot process of the global zone when system memory is readily available for reservation. To configure a kernel zone to allocate its memory from an MRP instead of from system memory. Use the zonecfg
command to set the capped-memory:memory-reserve
property. The default SMF service FMRI is svc:/system/memory-reserve:zones
.
Memory alignment requirements apply to both the page size of an MRP and the memory size of a kernel zone that uses an MRP. If you want a kernel zone to use an existing MRP, the kernel zone's memory size must be aligned to the page size of the MRP. A kernel zone fails to boot if the memory is not aligned.
The page size that is used to populate an MRP is controlled by setting the config/pagesize-policy
property in the MRP SMF service. Valid values are smallest-only
, largest-available
, largest-only
, and fixed
. If you choose the fixed
value, you must set the config/pagesize
property in the SMF service. See the pagesize
(1) man page for the list of available page sizes on your platform.
For example, the system handles the pagesize-policy=largest-available
setting for kernel zones and MRPs as follows:
-
Kernel Zone. Based on a kernel zone's memory size, the system selects a suitable page size for the alignment. If a kernel zone's memory size and the memory page size that populate the MRP are aligned, a kernel zone that uses the MRP boots successfully. However, if these memory sizes are unaligned, the system adjusts the kernel zone's selected page size downward until it finds a valid alignment.
-
Memory Reservation Pool. When you use
config/pagesize-policy=largest-available
to populate an MRP, only kernel zones that have memory sizes that align to the MRP's page size can boot successfully. So, a kernel zone boot might fail because of a memory alignment mismatch between the kernel zone and the MRP.
For example, you have an MRP that is populated with 2-Gbyte pages. If you configure a kernel zone with 5 Gbytes of memory to use that MRP, the memory-alignment mismatch causes the kernel zone boot to fail.
Enabling, disabling, and refreshing the svc:/system/memory-reserve:zones
MRP service result in the following behavior:
-
Enabling the service creates a memory reservation in an MRP. If an error occurs or the reservation fails, the service goes into maintenance modes and it logs a message that describes the reason for the failure.
-
Disabling the service destroys the reservation in the MRP unless a kernel zone is using memory from the pool. If you attempt to disable the service while reserved memory is in use, the service instance drops into maintenance mode and it logs a message that describes the reason for the failure.
-
Refreshing the service modifies the reservation of the MRP. After you configure an MRP, you can adjust the reservation size and refresh the service to increase or decrease the amount of memory in the pool. If the service fails to adjust the reservation size, an error message is logged and the MRP service is placed in the degraded state.
Note that using memory from an MRP for a kernel zone might cause the live migration of such a kernel zone to fail in the following circumstances:
-
The MRP service instance specified by the
capped-memory:memory-reserve
property is disabled on the destination host. -
The page size of the MRP service on the destination host cannot be smaller than the page size on the source host.
Be sure to perform a live migration dry-run to detect potential migration failures.