Linux 如何找到使用特定内核模块的进程列表?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9029526/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 04:15:02  来源:igfitidea点击:

How to find the list of processes using a particular kernel module?

linuxdriverkernel-module

提问by Raj

When I try to rmmod a module I get the error message "Error: Module in use" , lsmod | grep <module name>shows the count.
Is there a way that would tell me which processes are using this particular kernel module/driver?

当我尝试 rmmod 一个模块时,我收到错误消息 "Error: Module in use" ,lsmod | grep <module name>显示计数。
有没有办法告诉我哪些进程正在使用这个特定的内核模块/驱动程序?

回答by wallyk

This was asked before, but there was no great answer, probably because there is no good way to accomplish to find what is using what.

这是之前问过的,但没有很好的答案,可能是因为没有很好的方法来完成找到什么用什么。

The best suggestion is to dmesgand look for any indication of what loaded the module.

最好的建议是dmesg寻找加载模块的任何指示。

You might also try using the --forceparameter to rmmodin case your kernel was built with support for it.

您也可以尝试使用--force参数 tormmod以防您的内核是在支持它的情况下构建的。

回答by Kiran Padwal

lsof /dev/ might help you to find the dependent process.

lsof /dev/ 可能会帮助您找到相关进程。