You are not logged in.

#1 2015-03-04 17:23:46

weirddan455
Member
Registered: 2012-04-15
Posts: 213

Any downside to compiling drivers into the kernel instead of modules?

I finally got around to doing a custom configuration on a kernel (using the shiny new 4.0 rc2.)  I noticed the upstream defaults were to compile everything in and had very few, if any, options set to be modules.  I just continued with that trend and compiled every module that was getting auto-loaded at boot on the stock kernel straight into the kernel image.  I figured if the module was being loaded all the time anyway, why not?  I understand distribution kernels modulate everything because everyone has different hardware but is that really the way to go for a custom kernel?

Anyway I went from having all these modules loaded:

$ lsmod
Module                  Size  Used by
snd_hda_codec_hdmi     49263  1 
btusb                  29996  0 
nvidia               8335766  35 
bluetooth             403971  2 btusb
rfkill                 18867  1 bluetooth
joydev                 17063  0 
mousedev               17272  0 
iTCO_wdt               12831  0 
iTCO_vendor_support    12649  1 iTCO_wdt
mxm_wmi                12515  0 
coretemp               12820  0 
hwmon                  12930  1 coretemp
intel_rapl             17356  0 
x86_pkg_temp_thermal    12951  0 
intel_powerclamp       17122  0 
kvm_intel             143295  0 
kvm                   426425  1 kvm_intel
evdev                  21544  9 
mac_hid                12633  0 
pcspkr                 12595  0 
serio_raw              12849  0 
snd_hda_codec_realtek    63196  1 
snd_hda_codec_generic    63087  1 snd_hda_codec_realtek
i2c_i801               16965  0 
lpc_ich                20768  0 
drm                   263481  4 nvidia
r8169                  80917  0 
snd_hda_intel          26387  0 
snd_hda_controller     26938  1 snd_hda_intel
snd_hda_codec         112621  5 snd_hda_codec_realtek,snd_hda_codec_hdmi,snd_hda_codec_generic,snd_hda_intel,snd_hda_controller
i2c_core               50152  3 drm,i2c_i801,nvidia
mii                    12675  1 r8169
snd_hwdep              17244  1 snd_hda_codec
fan                    12726  0 
thermal                17559  0 
snd_pcm                88785  4 snd_hda_codec_hdmi,snd_hda_codec,snd_hda_intel,snd_hda_controller
battery                17452  0 
wmi                    17339  1 mxm_wmi
snd_timer              26614  1 snd_pcm
snd                    73436  8 snd_hda_codec_realtek,snd_hwdep,snd_timer,snd_hda_codec_hdmi,snd_pcm,snd_hda_codec_generic,snd_hda_codec,snd_hda_intel
tpm_infineon           16882  0 
soundcore              13031  2 snd,snd_hda_codec
tpm_tis                17182  0 
tpm                    31467  2 tpm_tis,tpm_infineon
video                  18043  0 
mei_me                 17941  0 
mei                    75336  1 mei_me
shpchp                 35210  0 
processor              27777  0 
button                 12953  0 
sch_fq_codel           17343  2 
ext4                  510292  3 
crc16                  12343  2 ext4,bluetooth
mbcache                17171  1 ext4
jbd2                   86379  1 ext4
algif_skcipher         17051  0 
af_alg                 12988  1 algif_skcipher
dm_crypt               22551  2 
dm_mod                 93459  5 dm_crypt
sr_mod                 21903  0 
sd_mod                 43575  5 
cdrom                  47479  1 sr_mod
ata_generic            12490  0 
pata_acpi              12771  0 
hid_generic            12393  0 
usbhid                 48595  0 
hid                   106316  2 hid_generic,usbhid
atkbd                  22254  0 
libps2                 12739  1 atkbd
ahci                   33248  3 
libahci                27215  1 ahci
crct10dif_pclmul       13394  0 
crc32_pclmul           12915  0 
crc32c_intel           21809  0 
ghash_clmulni_intel    12978  0 
ata_piix               33592  0 
aesni_intel           167997  4 
aes_x86_64             16719  1 aesni_intel
libata                181518  5 ahci,pata_acpi,libahci,ata_generic,ata_piix
lrw                    12757  1 aesni_intel
gf128mul               12970  1 lrw
glue_helper            12649  1 aesni_intel
ablk_helper            12572  1 aesni_intel
cryptd                 18553  5 ghash_clmulni_intel,aesni_intel,ablk_helper
scsi_mod              147580  3 libata,sd_mod,sr_mod
xhci_pci               12675  0 
ehci_pci               12512  0 
xhci_hcd              152471  1 xhci_pci
ehci_hcd               69939  1 ehci_pci
usbcore               199382  6 btusb,ehci_hcd,ehci_pci,usbhid,xhci_hcd,xhci_pci
usb_common             12561  1 usbcore
i8042                  18002  1 libps2
serio                  18282  4 serio_raw,atkbd,i8042

To this:

$ lsmod
Module                  Size  Used by
nvidia               8323751  35 
mxm_wmi                 1419  0 
wmi                     8171  1 mxm_wmi

wmi was required to be built as a modules since I compiled nouveau as a module for fallback in case nvidia didn't work or I wouldn't even have that loaded.  Nvidia, of course, has to be a module since it's built outside the tree.

Offline

#2 2015-03-04 22:20:23

Soukyuu
Member
Registered: 2014-04-08
Posts: 854

Re: Any downside to compiling drivers into the kernel instead of modules?

From what I know, the only downside is that the driver will be loaded even if it's not needed. So you only compile stuff in which is always present in your machine anyway, and compile as module if it's a removable device.

On the list you posted, I'd leave bluetooth (and related modules) as modules, because you can usually disconnect the BT adapter, in which case I think the module would be unloaded. On the other hand, with current systems and the large amount of available RAM it's more of a matter of preference than RAM usage.


[ Arch x86_64 | linux | Framework 13 | AMD Ryzen™ 5 7640U | 32GB RAM | KDE Plasma Wayland ]

Offline

#3 2015-03-04 22:40:22

weirddan455
Member
Registered: 2012-04-15
Posts: 213

Re: Any downside to compiling drivers into the kernel instead of modules?

I think I actually didn't compile bluetooth at all now that you mention it.  I only seldom use it but I leave the Bluetooth dongle plugged in all the time.  The few removable devices I did compile as modules.  Also the FAT and loopback filesystems and some crypto libraries I don't use all that much I made modules.

I just looking back in my config and I can't even find where to enable it.  Do you happen to know what category it's in?  I got tired by the end of configuring all that (took forever) so obviously I missed a thing or two.

It also looks like my PS3 controller support got compiled out because I selected it (as a module) but then later on in the config I disabled support for LEDs because I don't have any save for my power/hdd light but it turns out the PS3 driver depends on LEDs so it silently disabled PS3 support and hid the option from me so I had to select show all options just to find the problem...

Offline

#4 2015-03-04 23:01:56

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,659

Re: Any downside to compiling drivers into the kernel instead of modules?

You can pass parameters to a kernel module when you modprobe it.  To change them, you can rmmod the module  and then modprobe with the new parameters. 
Compiled in drviers can only be passed parameters from the kernel command line; you have to reboot to change them


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

Board footer

Powered by FluxBB