kidle_inject uses cpu power without apparent reason [duplicate]

Because you enabled Intel P-state (through intel_pstate=enable in GRUB_CMDLINE_LINUX_DEFAULT), you've also enabled the powerclamp driver. The powerclamp driver is working to try to keep the processor at a low-power state, so that power consumption is reduced, and not as much cooling is required.

To do this, it forces each thread on the CPU to be idle for some amount of time by injecting idle time. Typically, this amount is 50%. The 50% you see for each of the kidle_inject processes isn't actually causing the CPU to do work; rather, it's telling the CPU not to do work, thus reducing power consumption. Note that the overall CPU usage does not include kidle-inject.

As @ElderGeek noted, you can tell the driver to inject a less amount of idle time. However, I tried this, and was unsuccessful. It may be that the kernel doesn't support it yet; it may be that powerclamp is ignoring the request.


I think there must be some kind of bug here, since on my system, kidle_inject injects 50% in all CPUs, so that when I run a single threaded process, it only gets the remaining 50% of the CPU it runs on. rmmod intel_powerclamp fixes this.


If you take a look at the temperature and trip points in

/sys/class/thermal/thermal_zone0/temp

and

/sys/class/thermal/thermal_zone0/trip_point_0_temp

you may find (as I did and then found myself at this question), that your system is running so hot that it is managing temperature by injecting idle cycles as @elder-geek mentioned.

In my case it's the hottest day of the year so far and my fan has failed, but my laptop is surviving thanks to this feature.