numa_getaffinity,
- Provided by: freebsd-manpages (Version: 11.1-3)
- Report a bug
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_NONEdomain is -1.VM_POLICY_ROUND_ROBINdomain is -1.VM_POLICY_FIXED_DOMAINdomain 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_ROBINdomain 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_TOUCHdomain is -1.VM_POLICY_FIRST_TOUCH_ROUND_ROBINdomain 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>