Linux开启Lockdep检测内核死锁

Lockdep是内核检测deadlock的手段,默认没有开启,需要make menuconfig增加配置开启,在Hacking Kernel选项下面Y选择如下配置

 1. [*] Detect Hard and Soft Lockups
 2. [*] Detect Hung Tasks
 3. [*] RT Mutex debugging, deadlock detection
 4. -*- Spinlock and rw-lock debugging: basic checks
 5. -*- Mutex debugging: basic checks
 6. -*- Lock debugging: detect incorrect freeing of live locks
 7. [*] Lock debugging: prove locking correctness
 8. [*] Lock usage statistics
保存配置编译安装内核,重启后proc下生成如下文件说明lockdep开启了。

/proc/lockdep
/proc/lockdep_chains
/proc/lockdep_stat
/proc/locks
/proc/lock_stats
运行系统如果出现死锁,dmesg会给出提示信息。


参考:https://stackoverflow.com/questions/20892822/how-to-use-lockdep-feature-in-linux-kernel-for-deadlock-detection

你可能感兴趣的:(Linux内核)