Allows callers to get or set their applications' default memory placement policies.
Standard C Library (libc.a)
#include <sys/rset.h>
#include <sys/vminfo.h>
int vm_mem_policy(int cmd, int *early_lru, int *policies, int num_policies)
The vm_mem_policy system call allows callers to get or set their applications' default memory placement policies for different types of memory.
Item | Description |
---|---|
P_FIRST_TOUCH | Places the memory at the MCM where the application first referenced it. This is also achieved by setting the MEMORY_AFFINITY environment variable to MCM and benefit the applications with an identified home MCM to run on. |
P_BALANCED | Uses the stripe memory in the application across all the system's MCMs. This benefits applications that do not identify a home MCM to run on, or on global memory objects that is accessed by many applications. |
P_DEFAULT | Accepts the system's default policy for memory placement, which can be either the first touch or balanced policy, depending on the circumstances and the type of memory. |
The vm_mem_policy system call allows the caller to get or set the early_lru flag, which triggers the system to look for stealable pages immediately after a P_FIRST_TOUCH driven scan for local memory (the memory on the same MCM the application is running on) does not find any available pages.
The parameters policies, and num_policies allow a caller to fine control over the default memory placement policies of different types of memory. The policy settings take effect on any new memory page the application creates after having called this function. The existing memory pages of the application retains their existing memory placement.
Item | Description |
---|---|
cmd | A command that is either VM_SET_POLICY or VM_GET_POLICY. The VM_GET_POLICY command copies the current policy setting into the buffers supplied by the caller, and does not change any of the process policies. The VM_SET_POLICY command reads input from the supplied buffers and changes the process policies accordingly. |
early_lru | A pointer to an integer that indicates the
state of the early_lru setting for first touch policy. Enabling early_lru causes
memory to be paged out in order to fulfill a first-touch request for
memory placement. The possible values for early_lru are:
|
policies | A pointer to an array of policies for distinct
types of memory. Each array element contains one of the policy types.
The array element contains -1 to leave the policy unchanged for the
corresponding memory type. The array must be declared with a length
of VM_NUM_POLICIES. The list that follows enumerates the memory
types whose policies can be changed in the form of constants. Enter
the constant that is an array index into the policies array for the
corresponding memory type.
|
num_policies | Number of elements in the policies array. This value must be set to VM_NUM_POLICIES. |