These seem to control some kind of Active/Inactive state of cores which must be something different than the Online/Offline state, because the cores are still shown as Online, e.g. in /sys/devices/system/cpu/offline
and /sys/devices/system/cpu/online
, or in the /sys/devices/system/cpu/cpu0/core_ctl/global_state
file. Please note how in e.g. /sys/devices/system/cpu/cpu0/core_ctl/global_state
file where details of all cores are listed, there is a clear distinction between “Active cores” and “Online” states.
In order to switch a core to offline mode, one needs to:
echo 0 > /sys/devices/system/cpu/cpuX/online
and only then it gets really offline and is listed as such in /sys/devices/system/cpu/offline
, /sys/devices/system/cpu/online
, /sys/devices/system/cpu/cpuX/core_ctl/global_state
, etc.
I’ve switched all cores but 0-1 to offline and there’s a noticeable performance drop, but I haven’t yet tested how it affects power consumption.
Also, while I can switch a core between online and offline manually by writing 0 or 1 to the corresponding file, I cannot find any mechanism to do it automatically based on load (similar to the one you posted that switches cores between active/inactive).
Well, I’ll need to test it if it gives any power saving. If it does, at least it will be easy to handle it programmatically, e.g. patch the Battery saving mode to additionally switch cores to offline.