sys_sched_getaffinity  [kernel/sched.c]


Gets a process's CPU affinity mask

A process's CPU affinity mask determines the set of CPUs on which it is eligible to run. On a multiprocessor system, setting the CPU affinity mask can be used to obtain performance benefits. For example, by dedicating one CPU to a particular process (i.e., setting the affinity mask of that process to specify a single CPU, and setting the affinity mask of all other processes to exclude that CPU), it is possible to ensure maximum execution speed for that process. Restricting a process to run on a single CPU also prevents the performance cost caused by the cache invalidation that occurs when a process ceases to execute on one CPU and then recommences execution on a different CPU.

Arguments

eax 242
ebx PID of the process. If it's zero then the mask of the calling process is returned.
ecx Length in bytes of the buffer pointed to by edx. Should be equal to the size of cpumask_t structure.
edx Pointer to a buffer which will receive the cpumask_t structure:
struc cpumask_t
{
bits rd ((NR_CPUS+31)/32)
}

Return values

If the system call succeeds the return value is 0.
If the system call fails the return value is one of the following errno values:

-EFAULT A supplied memory address was invalid.
-EINVAL Size of the buffer pointed by edx is smaller than sizeof.cpumask_t.
-ESRCH The process whose ID is ebx could not be found.

Remarks

n/a

Compatibility

n/a