392

Occasionally my machine will have a kernel_task instance max out the CPU:

high kernel_task CPU usage

This can last from minutes to sometimes hours. The machine is effectively unusable in this state. Restarting doesn't help; a new kernel_task pops up again until it finishes whatever it's doing.

How can I find out what this process is doing?

  • 2
    @bmike I managed to both reproduce the issue and fix it at will. iStatMenus graphs confirm, the cause in my case is high chassis temperature from charging and peripherals plugged in to the left TB ports. – Adam Jul 6 '19 at 1:42
  • 2
    Yes - that temperature sensor does have the ability to cause this precisely. Thanks for the edit - that helps clarify greatly the situation for the record. – bmike Jul 6 '19 at 13:12
  • 1
    Just for reference (not any fix or workaround), kernel_task (PID 0) is the kernel (i.e., heart of the OS) itself and the very first process after the macOS/iOS/tvOS/watchOS boot process. Several core features are done in the kernel, temperature control being one of them, and it seems it’s exactly that that is behaving badly. This process obviously can’t be killed without bringing the whole system down so it’s especially bad when something in it misbehaves. Apple mentions its temperature control feature here: support.apple.com/en-us/HT207359 – Constantino Tsarouhas Apr 24 at 7:07
  • 1
    @BlakePetersen I went down that red herring at first too. The issue is unrelated to whether or not Docker is running, and frankly any other piece of software I could kill. – Adam Apr 25 at 0:23
  • 1
    @ConstantinoTsarouhas that Apple link is patently wrong. The graphs below clearly show a kernel_task with very low CPU temperatures. High CPU temperature is fixed by throttling the CPU, not by kernel_task. – Adam Apr 25 at 0:25

10 Answers 10

570

TLDR; If your MacBook Pro runs hot or shows a high % CPU for the kernel task, try charging on the right and not on the left.


High kernel_task CPU Usage is due to high chassis temperature caused by charging. In particular Left Thunderbolt port usage.

Solutions include:

  • Move charging from the left to the right side. If you have a second charger then plug it in on the right side. Avoid plugging everything on the right side (see last paragraph below).
  • Unplug something from the left side. Either power or another accessory until the battery is full.
  • Force fans to max before plugging in. iStatMenus has an easy Sensors -> Fans menu item to do so. This only helps in marginal conditions.
  • Move to a cooler room.

Proof:

Actual CPU temperature or application CPU usage is uncorrelated with kernel_task. A hot CPU is throttled by reducing its clock speed, not by scheduling fake no-op load.

The graphs below are from iStatMenus. The machine had been used on battery then plugged in.

State A a USB-C hub (a mouse and keyboard, plus power) and a USB-C HDMI 2.0 adapter, both on the left side. You can see the Thunderbolt Left Proximity temperature sensor rise quickly. About 3-4 minutes later the dreaded kernel_task high CPU usage starts.

State B cures the kernel_task problem by moving power from the left ports to the right. The left side temperature drops and the kernel_task goes away within about 15 seconds.

This is causal. Moving power back to the left side, restoring State A, quickly restores the temperatures and kernel_task again comes back after 3-4 minutes. Again moving power back to the right side, restoring State B, resolves the problem immediately.

State C shows that simply having stuff plugged in to TB ports raises their temperature significantly. Both the hub (mouse and keyboard ONLY) and HDMI adapter individually raise the temperature about 10 degrees, and 15 degrees together.

CPU usage and temperature graphs

(all other temperatures were both low and flat. Under 55 degrees.)

Note that high temperature on the right side appears to be ignored by the OS. Plugging everything into the two right ports instead of the left raised the Right temperatures to over 100 degrees, without the fans coming on. No kernel_task either, but the machine becomes unusable from something throttling.

Ergo, high CPU usage by kernel_task is caused by high Thunderbolt Left Proximity temperature, which is caused by charging and having normal peripherals plugged in at the same time.

2017 15" Macbook Pro, MacOS 10.14.5


To actually answer the question:

How can I find out what this process is doing?

The only way to actually ask the kernel what it's doing is to attach a kernel debugger. That means getting a debug kernel from Apple, rebooting, then using a second Mac to attach to the debugged machine. You can then examine stack traces and guess what they mean.

Otherwise guessing and testing is the only way. Of course that leads to false conclusions more often than not.

| improve this answer | |
  • 13
    this exact problem has been plaguing me to the brink of insanity for months, and I've tried everything to stop it. Recently, rolling back to HS from Mojave "solved" it, but it came back tonight out of the blue a week later, with seemingly no event triggering it again. I've don't about 30 different steps that I've found in forums over probably 40 hours since starting to troubleshoot. A new user on the same system seems to start fresh, but inevitably the problem comes back. I too feel like it has something to do with power/thunderbolt/heat. – Ellis Edwards Jul 6 '19 at 3:04
  • 17
    Just found this answer after my brand new MacBook Pro 16" 'went nuts' on me with ridiculously high kernel_task CPU usage straight after reboot, every time. In my case I had an unofficial PSU (Anker) feeding a Lention C13 plugged in to a left hand side port on the MacBook. I'm now using the official PSU plugged in to the right hand side of the MacBook and all is fine again. Thanks for the help but, honestly, I'm gobsmacked that Apple's hardware and/or OS doesn't handle this better. – Quintin Willison Mar 11 at 9:48
  • 11
    Just wanted to note that this answer is slightly incorrect, while still hugely useful of course. This is ONE of the causes of high kernel_task CPU usage - not the only one. You can observe that on Macs without Thunderbolt ports for example or on Macs without a battery (I.e. no charging). It is incorrect that high CPU temperature is only corrected by throttling the frequency - Kernel_task will in fact schedule “no-ops” in order to make the CPU use less power in this case. – jksoegaard Mar 21 at 12:31
  • 9
    @Adam It's not just some hypothesis that I have... I have read the actual kernel code for doing so. It's definitely not bullshit. I haven't said that it is "caused by CPU usage" - that's completely not true. It is however caused by TEMPERATURE. And yes, I know that a CPU can be throttled through frequency control - but this is something entirely different meant for an "out of the ordinary situation" (i.e. cooling failure). And yes, I know that CPUs automatically control their frequency and/or shutdown entirely when reaching their max Tjunction... that's a seperate mechanism. They have [...] – jksoegaard Mar 21 at 20:13
  • 19
    If you're a developer, you can take a look at the kernel source code in kern/thread_info.h, here you'll find the that the flag "TH_FLAGS_GLOBAL_FORCED_IDLE", which means that the purpose of the thread is to force idleness. In kern/thread.h you'll find that the thread option for it is TH_OPT_GLOBAL_FORCED_IDLE, which is described as "Thread performs forced idle for thermal control". Actually starting this process is triggered in the PlatformPlugin - i.e. on a new Mac you'll be looking at the ACPI SMC Platform Plugin's "ForcedIdlePLimit". You can search your logs for "plimit" and "p-state" [...] – jksoegaard Mar 21 at 20:54
30

Today I had this problem.

Interestingly, after changing the port I'd been using for charging the laptop and using a different port of the laptop, the CPU usage dropped:

enter image description here

| improve this answer | |
  • 3
    What is the time scale of this chart? I assume it takes some time to observe the drop if you change port – Jacopofar Apr 26 at 5:57
  • 3
    Immediately. Literally 2sec! – CoyBit Apr 26 at 8:19
  • MacBook Pro Early 2015: I had this problem a few minutes ago. I was charging an iPhone Xs and the Kernel was going mad (As it normally does now and then). Then I remembered seeing a discussion about this on Hacker News a few days ago that linked to this page. So I've just unplugged the phone. Lo and behold, the CPU load has gone down exactly like in your image here. Crazy crazy. Who would have thought!? – lukik May 12 at 16:08
  • Same situation here. I was charging the Mac via the left Thunderport port and a Promise Technology TD-300 Thunderbolt 3 Dock. Earlier today the Mac ground to a halt due to CPU usage by kernel_task as high as 6000% capacity. Finding this article I unplugged it from the left side and plugged it in via the right side and the CPU usage dropped to normal levels immediately. – cluther May 22 at 2:42
15

As it persists for a very long time, and it persists across restarts, it seems likely that your problem is caused by a hardware problem - namely lack of cooling. You do not describe which type of computer you have, but try looking at its cooling to see if it's working as intended. You might have a broken fan, lots of dust or similar.

The kernel_task virtual process does, amongst other things, throttle CPU usage in order to keep the CPU below its maximum operating temperature. The purpose is to keep the CPU from shutting down unexpectedly. kernel_task does this by ensuring that the CPU is doing nothing for long periods of time - essentially making sure the CPU uses as little power as possible, which means that it gives off less heat. This makes it seem like kernel_task is using a lot of CPU, but in reality it is not.

| improve this answer | |
  • 1
    You might be right that it's temperature related, but it's definitely not CPU temperature related. Your post made me enable iStat Menus' temperate sensor monitoring, and when this problem happened again the CPU was quite cool. See screenshot in edited OP. – Adam Jul 1 '19 at 22:02
  • If you start in Recovery mode, do you still have high kernel_task CPU "usage"? – jksoegaard Jul 1 '19 at 22:08
  • I anecdotally noticed that the kernel_task went away when the left thunderbolt temperature dropped below 70 degrees. I also noticed that plugging in a charger raises the temperature on the charging side by about 20-30 degrees. This means the effect is testable, and I'll confirm next time this problem happens. – Adam Jul 1 '19 at 22:08
  • I only tried recovery mode once and it made no difference. I haven't been able to reliably reproduce this. – Adam Jul 1 '19 at 22:09
  • "no difference" - does that mean that you also had high kernel_task usage there? – jksoegaard Jul 1 '19 at 22:10
6

For me this happens almost everytime I connect to an external monitor. The graphics switches to dedicated ones and the system starts to overheat in just under 5 min. Took me quite a while to figure this out. Room temperature is 27C so I don't think it's related to hot weather as well.

Funny thing is my 7 year old laptop still works fine under same conditions (even outperforms the MBP 2019).

| improve this answer | |
  • 2
    27C is very hot. I would say it’s definitely related to temperature. Buy a desk fan. – vaughan Apr 25 at 10:27
  • 1
    @vaughn Not really very hot, warm. The old saying "10 is cold, 20 is not; 30 is warm, 40 is hot." That said, 35C is the upper end of operating temperature and 27C is pushing that; so a fan is a good idea! – bishop May 23 at 2:26
  • 1
    There is definitely a link between ambient temperature and the mac book pro overheating when connected to an external screen. A few minutes after connecting the external screen, welcome kernel_task ! This is occurring on a Mac Book Pro End 2018 15" i9 6 cores + Samsung external screen (nothing else plugged in). I tried both connecting to the left and the right sides of the Mac book / rebooting / SMC / NVRAM/PRAM, same issue. I had the problem in May (which was around 27°C-30°) then no problem for a few days (ambient temperature had dropped 10°C) then again now (two days at 30°C). – yann-h Jun 25 at 22:48
5

If you're encountering this on Macbook Pro 16'' (2019), this seems to be a well-known problem regarding the laptop body not being able to handle the heat from both the CPU and GPU when external monitors are connected. The ultimate solution seems to be to use an eGPU... which would probably not be practical for most people.

An AMD Community thread further pointed out that the culprit is that the dGPU goes on full drive and draws ~20W of power whenever the laptop outputs to multiple monitors, seemingly because the driver lets the dGPU memory run on full clock speed "to avoid tearing". This quickly leads to the chassis overheating. Outputting to only one monitor (the count includes the built-in monitor), with no scaling or integer scaling of the resolution, seems to reduce the power usage to ~9W and thus solve the issue.

Funnily enough, whenever my Mac becomes sluggish, I seem to be able to put it to sleep and wake it up a couple of minutes later in order to make it responsive again for an hour, without closing any apps. This is likely because the power usage on the dGPU drops before going back to ~20W again.

| improve this answer | |
2

It’s usually temperature. Buy a small desk fan and point it at your MacBook rear. I used to have this problem and since using a fan it never happens.

| improve this answer | |
  • 11
    I don't think we expeected to do it on a 3000$ laptop :) – Stas Jun 18 at 10:51
  • 2
    Me neither! I maxed out the specs on my 2018 Macbook Pro which I thought would give me the processing power I need and save me from having to buy a new one for many years, but it seems the chassis is too thin and tightly packed to handle heavy use without getting really hot and then kernel_task having to slow everthing down to stop it overheating! – drkvogel Jun 26 at 8:55
  • I've heard that it sometimes helps cleaning inside of the MBP from the dust. Models 2012+ are eligible for a free battery exchange at Apple store, going to try it out and ask them to clean the dust out as well. Will see, it that helps with overheating at "not so hot" temperatures. – Sergey Shcherbakov Aug 10 at 15:45
0

Running spindump and or sample process from the activity monitor may help provide you with more information about what’s going on. Try to keep notice of when the CPU usage climbs and then look at the CPU Time on the other items listed in activity Monitor. You may notice a certain process starting up around the same time. Looking into threads in/out can help diagnose too. The issue could be either a bug within the kernel itself or whatever is requesting CPU time. It’s okay to have the CPU jump up every now and then if you don’t notice any system performance or temperature issues. Macs are built with their CPUs to withstand very high temps.

If you download a lot of apps the Launch Daemons, Launch Agents, and startup apps can add up quickly, possibly consuming CPU. It seems your system is having a lot of wake ups. Something could be hung up? You could also run “top” and “lsof” to get an idea of what the kernel is talking to. Also opening console and checking out the logs for any repeating errors helps. Testing a new user account will isolate any user related issues.

Look at you kernel panics and logs to see if there any reoccurring issues.
Make sure your fan starts spinning up when the computer gets warm. If not it could be a SMC issue. You can download software to control the speed of the fans to see if it reduces the CPU %.

The instruments app that comes with Xcode has some debugging and tracking features that also can help.

| improve this answer | |
0

First measure the temperature around the Mac and then see if cooler air reduces this.

In your case, Skype and Firefox are getting all the cycles left over due to running hot. Windowserver and kernel just do the bidding of the other programs. Also, for a longer term view of what the CPU is doing, watch the energy tab in activity monitor.

By closing the apps that take CPU, you can “let the system run cool”. Running like this won’t hurt things, just there are thermal limits so more efficient apps or less demanding tabs / video / content lets you get more work done before the system protects itself.

Also on Catalina, you can see actual GPU usage in Activity Monitor and test changes to browser settings if you think GPU is putting the machine into thermal throttling states.

| improve this answer | |
  • 2
    The CPU temperature is quite low when this problem happens. If anything, it might be due to chassis temperature, in my case hot thunderbolt ports due to charging. If that's true then apple should have throttled charging not the CPU. – Adam Jul 1 '19 at 22:04
  • You’re right. This isn’t the most obvious case and I’ll need to ponder the new data. Excellent edits @Adam I wonder if your circuitry is out of Spec if Apple runs diagnostics or this is just in spec (but unwanted) head generation from the power running through the power and data ASIC. – bmike Jul 1 '19 at 22:39
0

I own a MacBook Pro (15-inch, 2016). The theory given in accepted answer is correct that the cause of high cpu usage by kernel_task is due to the fact that you are plugging the charger in sockets at left. Using sockets at right immediately fixes the problem and the cpu usage for kernel_task dropped as well. However following are my findings,

  1. The problem did not occur till the MacOS Catalina update. The charging from left as well as right was fine on High Sierra and Catalina in my experience. I hope that Big Sur will acknowledge the problem and possibly fix it. You can try downgrading the OS and see if it fixes the problem.

  2. I recently replaced 3 year old stock thermal paste with Thermal Grizzly's Kyronaut and cleaned the dust accumulated over years with an anti-static brush. The results are amazing. I am no longer facing the over cpu utilisation by kernel_task while charging from either side. The fans are at 2000(ish)RPM on idle whereas it was 2600(ish)RPM.

I would really recommend the second option as it is much easier, cheap and doesn't incorporates any risk of any kind.

| improve this answer | |
  • The plots in the accepted answer were made on 10.14 Mojave so it's not a problem unique to 10.15 Catalina. – Adam Oct 19 at 17:40
  • @Adam No one really knows the cause of the problem. I believe since we all got our shiny new MBPs the left ports were as good as the right ones. I just shared my experience around the same problem. I could very well be wrong though and might have been lucky when cleaning dust off my old MBP. I might need some more people to test the theory in point 2 and see if this fixes the problem. – Arun Chaudhary Oct 20 at 4:58
0

I'll just leave this here in case it helps someone else:

For me, the issue went away when I switched to a charger with higher watt capacity. I accidentally had been running with a 15W charger instead of 87W. This caused the charging to be prolonged, heating up the whole computer.

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .