nsg_attach_pid(3)nsg_attach_pid(3)NAME
nsg_attach_pid, nsg_detach_pid - Attaches a process to, or detaches a
process from a NUMA Scheduling Group (libnuma library)
SYNOPSIS
#include <numa.h>
int nsg_attach_pid(
nsgid_t nsg,
pid_t pid,
ulong_t flags ); int nsg_detach_pid(
pid_t pid );
PARAMETERS
Specifies the NUMA Scheduling Group (NSG) to which the listed process
will be attached. Specifies the process ID to attach to (or detach
from) the NSG. Specifies a bit mask of options that affect the attach‐
ment. The following options are defined for the flags argument: The
requested attachment and any implied reassignment is mandatory, over‐
riding any prior attachment and/or binding of the specified processes.
Arrange for existing memory of the process that is assigned a new home
RAD to be migrated to the new RAD. If this option is omitted, only
newly allocated pages will be allocated on the new home RAD. Existing
pages will migrate if or when they experience a high rate of remote
cache misses. Migration will occur only for pages in memory objects
that have inherited the process's default memory allocation policy. A
child process will not inherit the NSG of the parent and, therefore,
can be assigned to any eligible RAD on the system. Wait for the
requested memory migration to be completed, if possible. If insuffi‐
cient resources exist to satisfy the request, the function will return
without having completed the migration. If NSG_INSIST is also speci‐
fied, memory not migrated will be paged out.
See DESCRIPTION for more detail about these options.
DESCRIPTION
The nsg_attach_pid() function attaches the process identified by the
pid argument to an NSG. An NSG is a set of processes and/or threads
that will be constrained to reside on the same Resource Affinity Domain
(RAD). That is, the “home RAD” for all of the processes or threads in
an NSG will be the same, and the entire group will be migrated
together, if at all. The process identified by pid will be removed from
any NSG of which it might currently be a member, before adding it to
the specified NSG.
If the pid argument is NULL, then the call is self-directed. That is,
the function behaves as if the current process ID were specified.
The nsg_detach_pid() will remove pid from its current NSG, if any, and
will not add pid to any new NSG. It is equivalent to the
nsg_attach_pid() function with the nsg argument of NSG_NONE.
RESTRICTIONS
The caller must have partition administration privilege and the process
identified by pid must be in the caller's partition.
RETURN VALUES
Success. In this case, the nsg_attach_pid() function successfully
attached to the NSG specified by nsg. Success. In this case, the
nsg_detach_pid() function successfully detached from its NSG. Failure.
In this case, errno is set to indicate the error.
ERRORS
If the nsg_attach_pid() function fails, it sets errno to one of the
following values for the condition specified: The caller does not have
execute permission required to attach processes to the NSG. The
process specified by pid does not exist. The nsg argument does not
specify a valid NSG, or one or more options in the flags argument are
invalid. The specified process is hard attached (RAD_INSIST) to RADs
or has memory wired (locked) on its current RAD such that the process
cannot be migrated to the RAD selected for the NSG. The NSG_INSIST and
NSG_MIGRATE options were specified and no RAD can be found with suffi‐
cient memory to accommodate the resulting group. The real or effective
user ID of the caller does not match the real or effective user ID of
the process specified in pid.
If the nsg_detach_pid() function fails, it sets errno to one of the
following values for the condition specified: The caller does not have
execute permission, which is required to detach processes from the NSG.
The process specified by pid does not exist. The process specified by
pid is not a member of an NSG. The specified process is hard attached
(RAD_INSIST) to RADs or has memory wired (locked) on its current RAD
such that the process cannot be detached. The real or effective user
ID of the caller does not match the real or effective user ID of the
process specified in pid.
SEE ALSO
Functions: nsg_init(3), numa_intro(3), pthread_nsg_attach(3)
Files: numa_types(4)nsg_attach_pid(3)