What you look for should be found inside this virtual file:
/sys/devices/system/cpu/isolated
and the reverse in
/sys/devices/system/cpu/present // Thanks to John Zwinck
From drivers/base/cpu.c
we see that the source displayed is the kernel variable cpu_isolated_map
:
static ssize_t print_cpus_isolated(struct device *dev,
n = scnprintf(buf, len, "%*pbl\n", cpumask_pr_args(cpu_isolated_map));
...
static DEVICE_ATTR(isolated, 0444, print_cpus_isolated, NULL);
and cpu_isolated_map
is exactly what gets set by kernel/sched/core.c
at boot:
/* Setup the mask of cpus configured for isolated domains */
static int __init isolated_cpu_setup(char *str)
{
int ret;
alloc_bootmem_cpumask_var(&cpu_isolated_map);
ret = cpulist_parse(str, cpu_isolated_map);
if (ret) {
pr_err("sched: Error, all isolcpus= values must be between 0 and %d\n", nr_cpu_ids);
return 0;
}
return 1;
}
But as you observed, someone could have modified the affinity of processes, including daemon-spawned ones, cron
, systemd
and so on. If that happens, new processes will be spawned inheriting the modified affinity mask, not the one set by isolcpus
.
So the above will give you isolcpus
as you requested, but that might still not be helpful.
Supposing that you find out that isolcpus
has been issued, but has not "taken", this unwanted behaviour could be derived by some process realizing that it is bound to only CPU=0
, believing it is in monoprocessor mode by mistake, and helpfully attempting to "set things right" by resetting the affinity mask. If that was the case, you might try and isolate CPUS 0-5 instead of 1-6, and see whether this happens to work.
pidstat -C isolcpus
. pidstat is from thesysstat
package. – Timothy Pulliam Jan 09 '17 at 15:46pidstat
andisolcpus
. Can you elaborate a little more ? – netmonk Jan 09 '17 at 15:53isolcpus
is, butpidstat
can tell you what CPU a process is running on if you pass the-C process_name
flag. For examplepidstat -C top
produces the following. – Timothy Pulliam Jan 09 '17 at 15:57isolcpus
is a kernel parameter wich forces the scheduler to not migrate any process by itself if they are isolated. For exemple on a 8 cpu servers,isolcpus=1-7
in the kernel command line, will force all spawned process forked by init and any kind of command in shell to run only on CPU0. To run a task on an isolated cpu, you need to launch it withtaskset
for exemple. So in regard of what i am asking, it seems your answer is out of topic. Thank anyway for trying to answer me – netmonk Jan 09 '17 at 15:58Consider the uptime is so big, that dmesg is no more displaying boot log to detect any error at startup. Basic answer like "look at kernel cmd line" will not be accepted
– netmonk Sep 22 '19 at 17:26