kupl_hbw_set_policy
Sets the current OPM memory allocation policy to a specified value.
Interface Definition
int kupl_hbw_set_policy(kupl_hbw_policy_t policy);
Parameters
Parameter |
Type |
Description |
Input/Output |
|---|---|---|---|
policy |
kupl_hbw_policy_t |
OPM memory allocation policy to be set. |
Input |
Return Value
- Success: KUPL_OK
- Failure: KUPL_ERROR
Examples
1 2 3 4 5 6 7 8 9 10 11 12 | #include <stdio.h> #include <assert.h> #include "kupl.h" int main() { int ret = kupl_hbw_set_policy(KUPL_HBW_POLICY_BIND); assert(ret == KUPL_OK); kupl_hbw_policy_t policy = kupl_hbw_get_policy(); assert(policy == KUPL_HBW_POLICY_BIND); return 0; } |
- The preceding example demonstrates how to configure and retrieve the current OPM memory allocation policy.
- The configured and retrieved KUPL_HBW_POLICY_BIND indicates that the current policy is to allocate memory from the nearest NUMA OPM node. If the OPM memory is insufficient, the allocation will fail, returning nullptr and reporting an error.
Parent topic: Memory Management Functions