kworker 進程是內核工作進程,並且有很多進程是無害的。
內核工作線程可以做任何事情,例如一些隨機的例子:
- 做頁面緩存寫回
- 處理某些種類的硬件事件 (如硬件中斷,定時器,I / O等)
- 很多很多其他的東西
要知道任何kworker在做什么,你可以看看。
1 cat /proc/<kworker_pid>/stack
第一種思路是使用perf進行排查,執行以下代碼
1 sudo echo "l" > /proc/sysrq-trigger //將loglevel設置為1 2 sudo perf record -g -a sleep 10 // 記錄10s內所有進程進行的動作,動作完成后會在當前目錄下生成一個perf.data 3 sudo perf report // 通過該命令進行查看
sysrq可以使用的command
66 'b' - Will immediately reboot the system without syncing or unmounting 67 your disks. 68 69
'c' - Will perform a system crash by a NULL pointer dereference. 70 A crashdump will be taken if configured. 71 72
'd' - Shows all locks that are held. 73 74
'e' - Send a SIGTERM to all processes, except for init. 75 76
'f' - Will call oom_kill to kill a memory hog process. 77 78
'g' - Used by kgdb on ppc and sh platforms. 79 80
'h' - Will display help (actually any other key than those listed 81 here will display help. but 'h' is easy to remember :-) 82 83
'i' - Send a SIGKILL to all processes, except for init. 84 85
'j' - Forcibly "Just thaw it" - filesystems frozen by the FIFREEZE ioctl. 86 87
'k' - Secure Access Key (SAK) Kills all programs on the current virtual 88 console. NOTE: See important comments below in SAK section. 89 90
'l' - Shows a stack backtrace for all active CPUs. 91 92
'm' - Will dump current memory info to your console. 93 94
'n' - Used to make RT tasks nice-able 95 96
'o' - Will shut your system off (if configured and supported). 97 98
'p' - Will dump the current registers and flags to your console. 99 100
'q' - Will dump per CPU lists of all armed hrtimers (but NOT regular 101 timer_list timers) and detailed information about all 102 clockevent devices. 103 104
'r' - Turns off keyboard raw mode and sets it to XLATE. 105 106
's' - Will attempt to sync all mounted filesystems. 107 108
't' - Will dump a list of current tasks and their information to your 109 console. 110 111
'u' - Will attempt to remount all mounted filesystems read-only. 112 113
'v' - Dumps Voyager SMP processor info to your console. 114 115
'w' - Dumps tasks that are in uninterruptable (blocked) state. 116 117
'x' - Used by xmon interface on ppc/powerpc platforms. 118 119
'z' - Dump the ftrace buffer 120 121
'0'-'9' - Sets the console log level, controlling which kernel messages 122 will be printed to your console. ('0', for example would make 123 it so that only emergency messages like PANICs or OOPSes would 124 make it to your console.) 125
根據kworker中執行的程序分析到有一些i2c傳輸的信息。執行
1 dmesg | grep i2c
對比正常的機器跟不正常的機器發現,不正常的機器一直在定時調度EDID。並且訪問不到。所以判斷是顯卡出現了問題,因為用的是PCI接口的集成顯卡
執行
1 lspci | grep VGA
查找到對應的pci設備號,然后執行以下命令移除集成顯卡
1 echo 1 > /sys/bus/pci/devices/對應的pci設備號/remove
移除后發現CPU負載下降為正常時候,不再出現定時負載超過50%的情況。由此推斷出是因為集成顯卡驅動的問題,所以需要聯系集成顯卡廠商,讓他們進行修改