I want to know the kernel modules which are not being used now. So, that I can disable them from loading at boot time?
Is there any method to see which kernel modules (of course, loaded) are not in use?
lsmod
shows you the currently loaded modules, as (excerpt):
Module Size Used by ... psmouse 87692 0 bluetooth 180104 7 bnep parport 46562 3 lp,parport_pc,ppdev serio_raw 13211 0 snd_ens1371 25747 4 gameport 19693 1 snd_ens1371 snd_ac97_codec 134826 1 snd_ens1371 joydev 17693 0 ...
However, just because Used is 0 for a particular module does not mean it is not in use!
Note that the kernel autoloads modules based on the hardware detected, except for the modules listed in /etc/modules
, which are "force"-loaded.
So if you remove or blacklist any of these modules beware: that piece of hardware may no longer work. e.g. if I remove/blacklist parport
, my parallel port won't work, which is OK if I never use it. The same goes for bluetooth
,etc.
The kernel modules take up relatively little memory on a modern PC, so the only time I'd recommend this kind of manual "optimization" is on embedded systems, etc. with little RAM.
From a later comment by OP, It seems that, he wanted to know the loaded unused modules names to disable them from auto loading in the boot time. It can be achieved by blacklisting them.
lsmod
– ish Jun 30 '12 at 09:44