LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-15-2004, 10:30 PM   #1
ganja_guru
Member
 
Registered: Dec 2003
Location: Chennai, India
Distribution: Arch Linux 0.7
Posts: 393

Rep: Reputation: 30
built in or module? any difference


will there be a noticeable difference in speed if i load all required drivers as modules, or will my system be faster if the drivers i need are built directly into the kernel?as of now i load almost everything directly into the kernel...?

thanx..
 
Old 10-16-2004, 02:31 AM   #2
UsualTuxpect
Member
 
Registered: Aug 2004
Location: New York
Distribution: --------- Gentoo-2004.2 [2.6.8] Redhat-9 [2.6.6]
Posts: 545

Rep: Reputation: 31
Compiling directly into a kernel vs. modules

You have two options for adding functionality to the kernel: building functions into the kernel (making a monolithic kernel) or adding them as modules.

Monolithic kernels:
Building a function into the kernel directly ensures that that function will be available at all times. The downside is that it makes your kernel bigger, increasing boot time, and ultimately using that much more memory to hold the kernel. If you are compiling a kernel to fit on a floppy so that you can boot Linux off a rescue floppy, space will become an issue.

Modules:
Building a function as a module allows that function to be loaded into memory as needed and unloaded when it is no longer needed. This helps keep your kernel small. It is very useful if, say, you are swapping hardware in and out of your system frequently. You could compile support for a variety of, say, sound cards as modules, and your Linux system will theoretically only load the driver that is appropriate for the hardware setup at the time.

Another benefit of building functions as modules is that parameters can be passed to the modules which can be useful in debugging your system if problems occur.

There are some considerations to be made when deciding if a kernel function should be modularized. A small performance penalty is paid as it takes a little time to get the module loaded and unloaded. There are some functions that are needed at boot time and these cannot be compiled as modules -- they need to be present in the kernel so your system can be loaded. For example, ext2/ext3/reiserfs file system support needs to be built into the kernel so that your partitions can be read, as you need to be able to read the filesystem to load modules. In my case, if I have PCMCIA support built into the kernel, then metworking works. If PCMCIA support is modularized, networking fails to start, probably because the PCMCIA support needs to be available very early in the boot process to set up networking.

General approach
The way that I approached kernel building was to see which functions I would need all the time versus the ones that I would only use infrequently. If it was a function that I would be using a lot, I built it directly into the kernel. Otherwise, I compiled it as a module. As I got more comfortable with recompiling the kernel, I started making more functions as modules, and honestly, have not seen that much change in system performance. On the other hand, my hardware setup is pretty static -- my machine is a laptop, and the only hardware option that I have is whether or not I have a USB mouse plugged into it.


The above stuff was contributed by wilburpan [Gentoo Forums]

All credits to him........
 
Old 10-16-2004, 03:01 AM   #3
CroMagnon
Member
 
Registered: Sep 2004
Location: New Zealand
Distribution: Debian
Posts: 900

Rep: Reputation: 33
If you're talking about required hardware drivers, the performance penalty will be negligible with modules, as the drivers will likely never be unloaded. By compiling in, you do save yourself potential module-loading issues (network module isn't loaded at boot, so you have to find out where your distro keeps its startup module file and edit that, and similar problems).

Realistically, in the case of modules you will want loaded all the time, there's not much benefit or penalty either way (except in vital situations, like your root FS ). I like to compile in everything I know will *always* be needed, and make everything else modules.
 
Old 10-16-2004, 03:36 AM   #4
ganja_guru
Member
 
Registered: Dec 2003
Location: Chennai, India
Distribution: Arch Linux 0.7
Posts: 393

Original Poster
Rep: Reputation: 30
ok ...thanx a lot!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Complie module or built-in support musicman_ace Linux - Software 4 12-19-2004 04:59 AM
Complie module or built-in support musicman_ace Linux - Software 2 12-19-2004 02:21 AM
Slackware 10- Please confirm my steps used to remove a module from a pre-built kernel jtp51 Slackware 7 11-03-2004 05:02 PM
built-to-order PC or ready-built PC from well-known companies? kpachopoulos General 6 11-03-2004 03:14 PM
iptables - module, or built into kernel? dunkyb Linux - General 3 02-16-2003 06:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration