sched_setaffinity.2: Improvements after comments by Florian Weimer

Reported-by: Florian Weimer <fweimer@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2015-07-22 18:43:40 +02:00
parent dde6d764a3
commit 9dbfb3b839
1 changed files with 6 additions and 3 deletions

View File

@ -241,7 +241,7 @@ system call returns the size (in bytes) of the
.I cpumask_t
data type that is used internally by the kernel to
represent the CPU set bit mask.
.SS Handling systems with more than 1024 CPUs
.SS Handling systems with large CPU affinity masks
The underlying system calls (which represent CPU masks as bit masks of type
.IR "unsigned long\ *" )
impose no restriction on the size of the CPU mask.
@ -251,7 +251,8 @@ data type used by glibc has a fixed size of 128 bytes,
meaning that the maximum CPU number that can be represented is 1023.
.\" FIXME . See https://sourceware.org/bugzilla/show_bug.cgi?id=15630
.\" and https://sourceware.org/ml/libc-alpha/2013-07/msg00288.html
If the system has more than 1024 CPUs, then calls of the form:
If the kernel CPU affinity mask is larger than 1024,
then calls of the form:
sched_getaffinity(pid, sizeof(cpu_set_t), &mask);
@ -262,8 +263,10 @@ the error produced by the underlying system call for the case where the
size specified in
.I cpusetsize
is smaller than the size of the affinity mask used by the kernel.
(Depending on the system CPU topology, the kernel affinity mask can
be substantially larger than the number of active CPUs in the system.)
.PP
When working on systems with more than 1024 CPUs,
When working on systems with large kernel CPU affinity masks,
one must dynamically allocate the
.I mask
argument.