Re: [PATCH v3 07/14] sched: Introduce restrict_cpus_allowed_ptr() to limit task CPU affinity
From: Peter Zijlstra
Date: Thu Nov 19 2020 - 11:10:26 EST
On Thu, Nov 19, 2020 at 01:13:20PM +0000, Will Deacon wrote:
> Sure, but I was talking about what userspace sees, and I don't think it ever
> sees CPUs that have been hotplugged off, right? That is, sched_getaffinity()
> masks its result with the active_mask.
# for i in /sys/devices/system/cpu/cpu*/online; do echo -n $i ":"; cat $i; done
/sys/devices/system/cpu/cpu1/online :0
/sys/devices/system/cpu/cpu2/online :1
/sys/devices/system/cpu/cpu3/online :1
/sys/devices/system/cpu/cpu4/online :1
/sys/devices/system/cpu/cpu5/online :1
/sys/devices/system/cpu/cpu6/online :1
/sys/devices/system/cpu/cpu7/online :1
# grep Cpus_allowed /proc/self/status
Cpus_allowed: ff
Cpus_allowed_list: 0-7
:-)