Issue
The red hat documentation regarding this file is vague. At first, it states that:
This file displays a list of all modules loaded into the kernel
But then later in the doc, it says:
The third column lists how many instances of the module are currently loaded. A value of zero represents an unloaded module.
So my questions are:
If the third value for a module is 0, does this mean that it is no longer loaded in the kernel right now? If so, then why do all of them still have a kernel address?
If /proc/modules only shows the currently loaded kernel modules, how can I find the list of all the kernel modules that will get loaded automatically after boot?
Solution
According to /kernel/module/procfs.c this third value is not the number of instances, but the reference count of the module (module_refcount
).
If a module has a reference count > 0 than it can't be unload safely (other modules expect it to be there), but if the reference count is 0 the module can be unloaded, but it's still loaded as of now.
Don't know why this documentation got it wrong.
2.
A systemd service called systemd-modules-load.service
loads modules at boot time. here is some documentation that shows how it works and where to look.
However, there is a different service for systems withoud systemd and I'm pretty sure you have some other ways of loading a modules.
Answered By - LITzman Answer Checked By - Senaida (WPSolving Volunteer)