numa_setaffinity, numa_getaffinity(2) | manage NUMA affinity |
numa_getaffinity, numa_setaffinity(2) | manage NUMA affinity |
NUMA_GETAFFINITY(2) | MidnightBSD System Calls Manual | NUMA_GETAFFINITY(2) |
numa_getaffinity
,
numa_setaffinity
— manage
NUMA affinity
Standard C Library (libc, -lc)
#include
<sys/param.h>
#include <sys/numa.h>
int
numa_getaffinity
(cpuwhich_t
which, id_t id,
struct vm_domain_policy_entry
*policy);
int
numa_setaffinity
(cpuwhich_t
which, id_t id,
const struct
vm_domain_policy_entry *policy);
numa_getaffinity
()
and numa_setaffinity
() allow the manipulation of
NUMA policies available to processes and threads. These functions may
manipulate NUMA policies that contain many processes or affect only a single
object.
Valid values for the which argument are
documented in cpuset(2).
These arguments specify which object set are used. Only
CPU_WHICH_TID
and
CPU_WHICH_PID
can be manipulated.
The policy entry contains a vm_domain_policy_entry with the following fields:
struct vm_domain_policy_entry { vm_domain_policy_type_t policy; /* VM policy */ int domain; /* VM domain, if applicable */ }
VM_POLICY_NONE
domain
is -1.VM_POLICY_ROUND_ROBIN
domain
is -1.VM_POLICY_FIXED_DOMAIN
domain
which must be set to a valid VM domain.
Pages will not be allocated from another domain if
domain
is out of free pages.VM_POLICY_FIXED_DOMAIN_ROUND_ROBIN
domain
which must be set to a valid VM domain. If
page allocation fails, pages will be round-robin allocated from another
domain if domain
is out of free pages.VM_POLICY_FIRST_TOUCH
domain
is -1.VM_POLICY_FIRST_TOUCH_ROUND_ROBIN
domain
is -1.Note that the VM might assign some pages from other domains. For example, if an existing page allocation is covered by a superpage allocation.
numa_getaffinity
()
retrieves the NUMA policy from the object specified by
which and id and stores it in
the space provided by policy.
numa_setaffinity
()
attempts to set the NUMA policy for the object specified by
which and id to the policy in
policy.
Upon successful completion, the value 0 is returned; otherwise the value -1 is returned and the global variable errno is set to indicate the error.
errno can contain these error codes:
EINVAL
]EINVAL
]numa_setaffinity
() did not contain a valid
policy.EFAULT
]ESRCH
]ERANGE
]EPERM
]cpuset(1), numactl(1), cpuset(2), cpuset_getaffinity(2), cpuset_getid(2), cpuset_setaffinity(2), cpuset_setid(2), pthread_affinity_np(3), pthread_attr_affinity_np(3), numa(4)
The numa_getaffinity
family of system
calls first appeared in FreeBSD 11.0.
Adrian Chadd <adrian@FreeBSD.org>
May 7, 2015 | midnightbsd-3.1 |