Search code examples
raspberry-picpu-usage

kworker has high CPU usage on idle system


Thanks for stopping by!

So I just bought a Pi desktop kit for my RaspberryPi 3B v1.2, which features an add-on module with an mSATA disk slot, real-time clock and power control. I installed the latest raspbian stretch (kernel version 4.9.59-v7+) on the mSATA SSD, and are now booting Raspbian from it with no SD card in the onboard card reader.

A kworker process is now constantly hogging between 8.0-13.5% CPU usage, which I think seems quite unnecessary, and it has annoying consequences, fx lagging videos with Kodi. This has never happened before I added the module.

kworker has high CPU usage as observed with top

I then tried perf (inspiration from this thread) by running sudo perf record -D 1000 -g -a sleep 20 and then sudo perf report to figure out which kernel tasks might be responsible:

sudo perf record -D 1000 -g -a sleep 20

But I can't figure out how to go on from there to reduce the workload. Could it be caused by the real-time clock embedded in the add-on board as __timer_delay, arch_timer_read_counter_long, and arch_counter_get_cntpct seem to have a high CPU usage? Other tasks with high load are finish_task_switch and _raw_spin_unlock_irqrestore tasks, but I can't guess what that's about.

Am I right that this is unnecessary work load of the CPU and if so, how can I reduce it?

Many thanks in advance!


Solution

  • I had the same issue and found the root cause was that I didn't insert SD card into my Raspberry Pi. When SD card is missing, the kernel frequently tries to scan the SD card slot, which causes high CPU usage. Download sdtweak.dtbo and replace the existing one under /boot/overlays/ with the new one, then add dtoverlay=sdtweak,poll_once into /boot/config.txt and reboot the machine. It worked for me.

    See also: https://github.com/raspberrypi/linux/issues/2567