kra_attachrset Subroutine
Purpose
Attaches a work component to a resource set.
Syntax
#include <sys/rset.h>
int kra_attachrset (rstype, rsid, rset, flags)
rstype_t rstype;
rsid_t rsid;
rsethandle_t rset;
unsigned int flags;
Description
The kra_attachrset subroutine attaches a work component specified by the rstype and rsid parameters to a resource set specified by the rset parameter.
The work component is an existing process identified by the process ID or an existing kernel thread identified by the kernel thread ID (tid). A process ID or thread ID value of RS_MYSELF indicates the attachment applies to the current process or the current kernel thread, respectively.
- The resource set must contain processors that are available in the system.
- The calling process must either have root authority or have CAP_NUMA_ATTACH capability.
- The calling process must either have root authority or the same effective userid as the target process.
- The target process must not contain any threads that have bindprocessor bindings to a processor.
- The resource set must be contained in (be a subset of ) the target process' partition resource set.
- The resource set must be a superset of all the thread's rset in the target process.
- The resource set must contain processors that are available in the system.
- The calling process must either have root authority or have CAP_NUMA_ATTACH capability.
- The calling process must either have root authority or the same effective userid as the target process.
- The target thread must not have bindprocessor bindings to a processor.
- The resource set must be contained in (be a subset of ) the target thread's process effective and partition resource set.
If any of these conditions are not met, the attachment will fail.
Once a process is attached to a resource set, the threads in the process will only run on processors contained in the resource set. Once a kernel thread is attached to a resource set, that thread will only run on processors contained in the resource set.
- All offline processors are ignored.
- If all the hardware threads (CPUs) of a physical processor (when running in simultaneous multithreading mode, there will be more than one active hardware thread per physical processor) are not included in the specified resource set, the other CPUs of the processor are ignored when constructing the ST resource set.
- Only one CPU (hardware thread) resource per physical processor is included in the ST resource set.
Parameters
Item | Description |
---|---|
rstype | Specifies the type of work component to be attached
to the resource set specified by the rset parameter. The rstype parameter
must be the following value, defined in rset.h:
|
rsid | Identifies the work component to be attached
to the resource set specified by the rset parameter. The rsid parameter
must be the following:
|
rset | Specifies which work component (specified by the rstype and rsid parameters) to attach to the resource set. |
flags | Specifies the scheduling policy for the work component being attached. The only supported value is R_ATTACH_STRSET value, which is only applicable if the rstype parameter is set to R_PROCESS. The R_ATTACH_STRSET value indicates that the process is to be scheduled with a single-threaded policy (only on one hardware thread per physical processor). |
Return Values
Upon successful completion, the kra_attachrset subroutine returns a 0. If unsuccessful, one or more of the following are true:
Item | Description |
---|---|
EINVAL | One of the following is true:
|
ENODEV | The resource set specified by the rset parameter does not contain any available processors, or the R_ATTACH_STRSET flags parameter is specified and the constructed ST resource set does not have any available processors. |
ESRCH | The process or kernel thread identified by the rstype and rsid parameters does not exist. |
EPERM | One of the following is true:
|