Reputation: 337
I'm trying to query the process available CPUs (on which CPUs he can run) using cpuset_getaffinity.
cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, getpid(),
sizeof(*cpuset), cpuset);
The cpu set returned by the query has all the system CPUs. I was wondering why and in which cases not all CPUs are available for a process?
Upvotes: 0
Views: 69
Reputation: 11
You can define witch CPUs are dedicated for lets say some processes you wanna highlight. I use 2 out of 8 CPUs for DPKD.
[root@myserver] cat /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0,115200 console=tty0 isolcpus=2,3 default_hugepagesz=2M hugepagesz=2M hugepages=1024"
You see that isolcpus=2,3 are dedicated for DPKD and they are 100% used.
%Cpu0 : 0.7 us, 0.7 sy, 0.0 ni, 98.7 id,
%Cpu1 : 12.5 us, 2.6 sy, 0.0 ni, 84.9 id,
%Cpu2 :100.0 us, 0.0 sy, 0.0 ni, 0.0 id,
%Cpu3 :100.0 us, 0.0 sy, 0.0 ni, 0.0 id,
%Cpu4 : 1.3 us, 2.0 sy, 0.0 ni, 92.6 id,
%Cpu5 : 0.3 us, 0.3 sy, 0.0 ni, 99.3 id,
%Cpu6 : 0.3 us, 0.3 sy, 0.0 ni, 99.3 id,
%Cpu7 : 0.3 us, 1.0 sy, 0.0 ni, 98.7 id,
So in this case, if this was your question, you see that not all CPUs are available to handle incoming processes.
Upvotes: 1