内核线程和用户态进程的cpu利用率过高时的调试方法
2015-10-04 21:37
204 查看
--kworker
What is kworker?
a Linux kernel process doing "work" (processing system calls). You can have several of them in your process list:
the one on your first CPU core,
one on your second etc..
Why does kworker hog your CPU? To find out why a kworker is wasting your CPU, you can create CPU backtraces: watch your processor load (with
something) and in moments of high load through
execute
See what happens frequently in the CPU backtraces, it hopefully points you to the source of your problem.
Example: e1000e. In my case, I found a backtrace like this nearly every time:
It hinted me to a problem in the
card module, and indeed a
用户态进程:
可以使用kill -6 pid杀掉进程,产生一个core文件。多次执行后,基本上就能看出来哪段代码在占用cpu。
What is kworker?
kworkermeans
a Linux kernel process doing "work" (processing system calls). You can have several of them in your process list:
kworker/0:1is
the one on your first CPU core,
kworker/1:1the
one on your second etc..
Why does kworker hog your CPU? To find out why a kworker is wasting your CPU, you can create CPU backtraces: watch your processor load (with
topor
something) and in moments of high load through
kworker,
execute
echo l > /proc/sysrq-triggerto create a backtrace. (On Ubuntu, this needs you to login with
sudo -s). Do this several times, then watch the backtraces at the end of
dmesgoutput.
See what happens frequently in the CPU backtraces, it hopefully points you to the source of your problem.
Example: e1000e. In my case, I found a backtrace like this nearly every time:
Call Trace: delay_tsc+0x4a/0x80 __const_udelay+0x2c/0x30 e1000_acquire_swflag_ich8lan+0xa2/0x240 [e1000e] e1000e_read_phy_reg_igp+0x29/0x80 [e1000e] e1000e_phy_has_link_generic+0x85/0x120 [e1000e] e1000_check_for_copper_link_ich8lan+0x48/0x930 [e1000e] e1000e_has_link+0x55/0xd0 [e1000e] e1000_watchdog_task+0x5e/0x960 [e1000e]
It hinted me to a problem in the
e1000eEthernet
card module, and indeed a
sudo rmmod e1000emade the high CPU load go away immediately [e1000e bug #26].
用户态进程:
可以使用kill -6 pid杀掉进程,产生一个core文件。多次执行后,基本上就能看出来哪段代码在占用cpu。
相关文章推荐
- Eclipse Tomcat改发布目录
- COGS 705——回家
- <五> 文件的压缩与打包
- CentOS 6.5 安装freeswitch
- 两圆 相交面积
- PO3281 Dining(最大流)
- JS 对象进阶
- java jar 包相关
- leetcode_263_Ugly Number
- Canvas初步
- Java多线程10:ThreadLocal的作用及使用
- HDU-5120-10.1训练赛-
- Android读书笔记------LaunchMode
- Exchange工具13—部署助理
- 数据挖掘之聚类
- pat1029Median (25)
- socket 编程之TCP服务端与客户端
- 替换空格
- 【转】研究生如何读文献 写论文 发文章 毕业论文
- studing method for linux