Get the App
SLTechnology News&Howtos  ›  Development  › 

What if Linux kworker occupies too much CPU?

Shulou Source: shulou.com Published: 2022-06-01 20:57:53 10月04日 Update

Today, I would like to share with you the relevant knowledge about how Linux kworker takes up too much CPU. The content is detailed and the logic is clear. I believe most people still know too much about this, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.

Open HTOP first

Htop then press H K (uppercase)

We can see that Kworker/0:0+events takes up a lot of CPU, so let's refer to the answer below.

What is kworker? Kworker represents the Linux kernel process that does "work" (handling system calls). There can be multiple processes in the list: kworker/0:1 kworker/1:1 is one on the first CPU kernel, one on the second CPU kernel, and so on.

Why does kworker take up your CPU? To find out why kworker is wasting your CPU, you can create a CPU traceback: observe your processor load (with or without top) and execute it at a high load of kworker, echo l > / proc/sysrq-trigger to create a traceback. On Ubuntu, this requires you to log in to sudo-s. Do this a few times, and then observe the backtracking at the end of the dmesg output. Look at what happens frequently in CPU backtracking in the hope that it will point to the root of the problem.

Install perf

Sudo dnf install perf.aarch74 # I use Huawei Yunkunpeng arm to modify all 10s backtracking records on CPU.

Sudo perf record-g-a sleep 10 then generates a perf.data in the current directory

Use the following command to view

Sudo perf report

We see that arch_cpu_idle takes up a lot of CPU. So I asked the people in the Fedora telegram group and looked at arch/arm64/kernel/process.c.

It turns out that no other process is using CPU,Linux to automatically save CPU operations. (in the future, I will transfer my blog to my own website, zhyz.ru.)

Doesn't this mean that simply no other process is using the CPU? From what I see, this is like the "Idle task" in Windows

Add: I don't know if both threads of BUG are full now.

These are all the contents of this article "what to do if Linux kworker occupies too much CPU". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Tags: Knowledge articles kernels processes what to do content reference processing observation different big and so on blogs reasons commands processors multiple uppercase mostly Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Linux vpn Apple Shulou Information