Code Yarns ‍👨‍💻
Tech BlogPersonal Blog


📅 2016-Mar-27 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ powerclamp ⬩ 📚 Archive

20160327_powerclamp On a notebook running Ubuntu 15.10, I noticed this strange phenomenon in HTop (see pic above). This notebook has an Intel i3 M330 CPU with 2 physical cores that appear as 4 hyper-threaded cores. I saw 4 kernel processes named kidle_inject, one process running on each virtual core. They were all occupying 50% of the core!

It turns out this is due to the Intel PowerClamp driver running in the Linux kernel. This is used for the power management, and hence the thermal management, of the computer. This is useful on thermally sensitive computers like notebooks, where a CPU running continuously at its highest permissible temperature might cause problems.

To prevent such problems, this driver monitors the idle time of each core over the most recent delta of time. When it notices that the core has not been idle for a certain desired idle time, these special high-priority kernel processes are started. They inject the requisite amount of idleness, putting the core to sleep, so that the idle time increases to the desired idle time.

This driver is registered to the kernel as intel_powerclamp. Its settings can be found under one of the cooling_device directories at /sys/class/thermal. For example, on my 4-core CPU system it was listed at /sys/class/thermal/cooling_device5. The max_state and cur_state files here show the desired idle time and the current idle time values. The desired idle time can be changed by changing the value in the max_state file.


© 2022 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘📧