Click to See Complete Forum and Search --> : Why use kernel modules?


elderdays
06-28-2004, 01:30 PM
Maybe this is a dumb question, but why should I compile anything as a module in my kernel. Is there some benefit to it?

squeegy
06-28-2004, 01:41 PM
My guess is, if you're not going to be using something like usb-storage all the time, you don't have to have it loaded into memory.

paj12
06-28-2004, 01:47 PM
It's mostly a speed issue. You can make a small kernel with only the stuff you need to boot up and then load modules for everything else as you need them. This will be a little bit faster than a monolithic kernel (everything compiled in) and will have a smaller memory footprint.

Choozo
06-28-2004, 02:31 PM
From a (paranoid) security point of view, loadable module support may be a Bad Thing(TM) as this will allow rouge code to insert an infected module into the running kernel.
The safest way is then to compile what you need into the kernel, and disable loadable module support.

Cheers :)

Loki3
06-28-2004, 02:41 PM
Why use modules? Well for distros like Mandrake and Fedora it's a great way to include hardware support for just about everything under the sun without having a huge a kernel. Just use a normal kernel and then have the hardware-automagical-detect-o-thing load the correct kernel modules for specific hardware.

I myself prefer a monolithic kernel. I'm on a laptop so it's not like the hardware changes frequently. I just compile in support for everything I use and everything else I don't bother with.

Dark Ninja
06-28-2004, 02:41 PM
Originally posted by paj12
It's mostly a speed issue. You can make a small kernel with only the stuff you need to boot up and then load modules for everything else as you need them. This will be a little bit faster than a monolithic kernel (everything compiled in) and will have a smaller memory footprint.

Faster where?

I would think a lot of modules would be slower because they each have to be loaded separately from the kernel (which still has to get loaded as well). Also, this could be slower because, when these modules are needed (so for USB support), they need to be loaded before they can be used.

I would think the advantage would be the size of the memory footprint. You'll only have things loaded that you absolutely need. Plus, modules also makes it easier to add support for devices into your system, rather than recompiling the entire kernel every time you want to do that.

elderdays
06-28-2004, 03:04 PM
whew! Thought I was gonna get flamed for asking that one :). I normally just wget the kernel source and build a monolithic kernel with everything I need inside. It is only about 1.8Mb, so, I was just wondering.

teeitup
06-28-2004, 03:41 PM
The loadable module setup was far more critical in the early days of Linux.
Slower machines with minimal memory. Keeping your kernel as small as possible, and only loading the modules you needed right then, made more memory available for applications.

With todays fast machine with large amounts of ram I don't think it's all that important.

Dark Ninja
06-28-2004, 05:04 PM
Just for some comparisons, I refer you to:

How Big Is Yours? (Kernel) (http://www.justlinux.com/forum/showthread.php?s=&threadid=126071)

:D

elderdays
06-29-2004, 11:32 AM
Originally posted by Dark Ninja
Just for some comparisons, I refer you to:

How Big Is Yours? (Kernel) (http://www.justlinux.com/forum/showthread.php?s=&threadid=126071)

:D That's funny! I'll post mine to it later. I'm about to build a new kernel. Also, I didn't know about the du command. I've needed that before and just did without it. Thanks for that link.