Skip to content

Shutting down cores. CPU hotplug

Core 0 can not be shutted down as some architectures may have some special dependency on a certain CPU.

echo 0 | sudo tee /sys/devices/system/cpu/cpu4/online

Possible states

cat /sys/devices/system/cpu/hotplug/states

Change a target

echo 140 > /sys/devices/system/cpu/cpu4/hotplug/target

CPU governor

List governors

sudo cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors

Set governor

echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

Interrupts

cat /proc/interrupts

stats

cat /proc/stat
---
cpu  863551 3429 857793 8085941 31541 33767 19313 0 33353 0

Meaning:

  • user: normal processes executing in user mode
  • nice: niced processes executing in user mode
  • system: processes executing in kernel mode
  • idle: twiddling thumbs
  • iowait: In a word, iowait stands for waiting for I/O to complete. But there are several problems:
  • Cpu will not wait for I/O to complete, iowait is the time that a task is waiting for I/O to complete. When cpu goes into idle state for outstanding task io, another task will be scheduled on this CPU.
  • In a multi-core CPU, the task waiting for I/O to complete is not running on any CPU, so the iowait of each CPU is difficult to calculate.
  • The value of iowait field in /proc/stat will decrease in certain conditions. So, the iowait is not reliable by reading from /proc/stat.
  • irq: servicing interrupts
  • softirq: servicing softirqs
  • steal: involuntary wait
  • guest: running a normal guest
  • guest_nice: running a niced guest

  • https://www.kernel.org/doc/Documentation/filesystems/proc.txt

tools

  • powertop power consumption and power management diagnosis tool.
  • cpupower Shows and sets processor power related values