Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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?

like image 823
Raj Avatar asked Jan 27 '12 05:01

Raj


People also ask

How do I list loaded kernel modules?

To list all currently loaded modules in Linux, we can use the lsmod (list modules) command which reads the contents of /proc/modules like this.

How do you find the PID of a kernel module?

In the case of pid, you can use: pid = task_pid_nr(current); to get the current task's pid. here is the comment taken from include/linux/sched.

What command would list any kernel modules currently in use?

Use the lsmod command to see what kernel modules are currently loaded. This is a list of the kernel module drivers which are currently loaded, as produced by the lsmod command.

Where can I find kernel module dependencies?

Instead, use the modprobe command followed by the kernel module name. modprobe attempts to load the module from /lib/modules/<kernel-version>/kernel/drivers/ . This command will automatically check for module dependencies and load those drivers first before loading the specified module.


1 Answers

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

like image 96
Kiran Padwal Avatar answered Oct 07 '22 00:10

Kiran Padwal