Update 2: explanation found, see further below.
I was working on my MacBook Pro today when the system became ultra sluggish. Activity Monitor showed the the process “kernel task” was consuming all four CPU cores, driving the fans full blast and making the laptop very hot. It was hard to get work done.
Air temperature was hot (about 85°), so that this macOS bug was making matters far worse by running all CPUs continuously. And it’s not like one can kill kernel task—that’s the protected core of macOS itself. I’ve seen this problem sporadically on other Macs; my belief is that it is an Apple bug, a longstanding one.
Rebooting did not solve the issues, it just started up again. I did some web searching and came up with no good answers other than a suggestion to reset the SMC controller. This I did not do.
Instead I shutdown the computer, then restarted it. The problem went away. So perhaps it is related to the SMC controller, and shutting down rejiggers something. A cold boot (shutdown and startup) might be different than a warm boot (restart) in what the system checks or does at startup. So shutting down makes some sense.
Update: it started happening again. I notice the laptop was very warm to the touch, with ambient air temperature of 90°F or so. It looks to be a bug in which the 2015 MacBook Pro cannot cool itself properly (even with fans going), and some low-level power and heat management module just goes bonkers running all 4 CPUs at 100%—rather self defeating.
Explanation (thanks to Mike N below)
If kernel_task is using a large percentage of your Mac CPU
One of the functions of the kernel task process is to help manage the temperature of your CPU.
Activity Monitor might show that a system process named kernel_task is using a large percentage of your CPU, and during this time you might notice more fan activity.
One of the functions of kernel_task is to help manage CPU temperature by making the CPU less available to processes that are using it intensely. In other words, kernel_task responds to conditions that cause your CPU to become too hot, even if your Mac doesn't feel hot to you. It does not itself cause those conditions. When the CPU temperature decreases, kernel_task automatically reduces its activity.
Mike N writes:
I've seen this behavior on many, mainly mobile, Macs. It is not a bug, in itself, in Apple's view. It is a deliberate feature to compensate for their inexcusable obsession with form _over_ function. Going back at least to the Apple III.
They describe this "'works' as designed" frankly in If kernel_task is using a large percentage of your Mac CPU.
As a remedy (if you 'know'/enforce that your cooling is indeed adequate): http://blog.viktorpetersson.com/post/136535061619/how-to-fix-kerneltask-cpu-usage-on-el-capitan
Thunderbolt chips are just not that well integrated into Apple's designs. Just a small, passive, unconnected heatsink, far away from the heatpipes and fans. Given that the new MacBooks do not have another port that amounts to pitiful decisions. Most of their mobile systems have only barely enough cooling capacity.
Overpriced and underpowered. It is said that one shall not attribute malice were usually stupidity provides an explanation just as good. But why don't they learn then? This just has to planned obsolescence.
This thermal folly of theirs is for example currently killing MacBookPros 2011 like summer flies. Not even but especially those that were serviced under the repair extension program for RadeonGate.
You probably know the heavily censored and despite that incredibly long thread at Apple's own forums. Just look at those desperate souls here: https://forums.macrumors.com/threads/force-2011-macbook-pro-8-2-with-failed-amd-gpu-to-always-use-intel-integrated-gpu-efi-variable-fix.2037591/
The situation you describe is actually a prime example of CoreRot. For the macOS is dark and full of errors.
MPG: at least there it is, plain to read.
Jarno Z writes:
It is with a very big surprise I read your article on that bug. I explain you why.
MBP 2015 as well, since three weeks ago I had the same bug with kernel working at 80% of the computing resources. I did everything on the basis. Reinstall the OS, change user, reinstalled the latest combo, reset SMC and so on. Nothing worked out.
I gave a thought about high room temperature. But was a false positive.
Then I had an idea. Maybe it is a connected peripheral. I detached everything. Symptoms away. Long story short. Thunderbolt. When something is connected to the thunderbolt, monitor or dock, whatever I have, at some point the CPU goes in protection, idling at 0.8 GHZ, and at that point the kernel task goes up to maximum. In reality then is the cpu stuck not the kernel going up, even though this is what appears.
MPG: when/if this happens again, I’ll unplug the display and see if the problem goes away. I’ll also check the Intel Power Gadget. In my case, the MBP was very warm to the touch everywhere, with ambient air temp of 90°F or so. Perhaps Thunderbolt is related and/or the root cause, but the issue needs reproducing to confirm Jarno’s suggestion. Thunderbolt is a relatively high power draw featur, and it could be that when things get too hot, the power management system takes the CPU down to minimal speed as a protective measure, rather than cutting off Thunderbolt.