LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-22-2006, 04:38 AM   #1
halturata
Member
 
Registered: Aug 2005
Location: Sofia
Distribution: SuSE, ELinOS
Posts: 100

Rep: Reputation: 16
How does loadable modules affect the overall performance of the linux system?


Hi there,

I read in couple of books and HOWTO's that modules loaded into the linux kernel (not compiled) come with a slight performance and memory usage penalty. So, my question is: Is this "penalty" gone if you compile the modules into the kernel, so it doesn't have to load it every time they are needed (except the larger size of the kernel)?

Thanks.

P.P. I know it's a luser-question but I couldn't find a comparison between performance with and without loaded modules.
 
Old 03-22-2006, 04:44 AM   #2
b0nd
Senior Member
 
Registered: Jan 2005
Distribution: Slackware, BackTrack, Windows XP
Posts: 1,020

Rep: Reputation: 45
hi,
ya its quite right that modules are loaded at the cost of memory and system performance.
Actually what happens, when a particular module is not found in memory.....its brought into memory, hence some other things(process may be) have to be swapped out of the main memory in order to bring this module into memory.
Hence some CPU cycles are used and since some other things are swapped out so they too would be swapped in some later time. Hence its affecting the performance.

Second thing. Why don't we compile all the modules ???
I don't have the clear idea. But as far as i know, by compiling all the modules into kernel, the size of kernel will increase. This will decrease the stability of the kernel as well as the speed of the system will degrade.
Smaller the size of kernel.......faster will be the system.

regards
 
Old 03-22-2006, 04:54 AM   #3
halturata
Member
 
Registered: Aug 2005
Location: Sofia
Distribution: SuSE, ELinOS
Posts: 100

Original Poster
Rep: Reputation: 16
Thanks!
 
Old 03-22-2006, 05:30 AM   #4
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
Quote:
I don't have the clear idea. But as far as i know, by compiling all the modules into kernel, the size of kernel will increase. This will decrease the stability of the kernel as well as the speed of the system will degrade.
Smaller the size of kernel.......faster will be the system.
Not sure if I agree with your points here. Sure the size of the kernel will increase with builtin support, but consider that the kernel hook code that must be used to bind a module to the running kernel also adds some size. As for stability, I do not think static kernels are less stable at all, in fact, logic would dictate that a kernel with removable parts would be less stable. That said, I don't think there is really a difference in stability at all.

And also, a smaller kernel does not directly translate to faster kernel, rather, one that just takes less space in memory.

My guideline for building kernels: anything you need all the time, such as network drivers, sound drivers etc should be static. Drivers/modules you only need some of the time, such as loopback devices, ramdisks, and transient filesystems are good canidates for modules.
 
Old 03-22-2006, 05:38 AM   #5
b0nd
Senior Member
 
Registered: Jan 2005
Distribution: Slackware, BackTrack, Windows XP
Posts: 1,020

Rep: Reputation: 45
Quote:
And also, a smaller kernel does not directly translate to faster kernel, rather, one that just takes less space in memory.
what i know and experienced is that after compiling the kernel (removing the drivers support which i don't require) it boots up faster. But i'm not sure that after booting and getting into X, will there be any increase in the speed of system.
Plz. explain it a bit.

and my linux guru once told me that compiling all the modules into kernel will increase the size of kernel and will make it unstable. Put some light on this concept also.

regards

Last edited by b0nd; 03-22-2006 at 05:42 AM.
 
Old 03-22-2006, 07:42 PM   #6
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
Quote:
what i know and experienced is that after compiling the kernel (removing the drivers support which i don't require) it boots up faster. But i'm not sure that after booting and getting into X, will there be any increase in the speed of system.
Plz. explain it a bit.
...exactly my point.

Quote:
and my linux guru once told me that compiling all the modules into kernel will increase the size of kernel and will make it unstable. Put some light on this concept also.
Well, I think we need to make the distinction between every possible module and every module you actually need for your hardware.

Of course if you add _everything_ your kernel will be absurdly huge. However, I strongly disagree that adding all your required drivers statically introduces any more instability than having them as modules, and I rather think it is the job of your Linux Guru to justify his own contention, not me.
 
Old 03-23-2006, 04:36 AM   #7
halturata
Member
 
Registered: Aug 2005
Location: Sofia
Distribution: SuSE, ELinOS
Posts: 100

Original Poster
Rep: Reputation: 16
So, I suppose in case you are dealing with an embedded system, it is better to have all things statically build into the kernel (after all you know exactly what will be needed), because loaded modules will eat up precious memory
 
Old 03-23-2006, 05:14 AM   #8
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
Quote:
because loaded modules will eat up precious memory
Well, I think the difference is quite negligible, probably on the order of 1k or less. Perhaps in an embedded device it may matter, but I do not know enough about such devices...

Bottom line: in a desktop/server machine, if you can tell any significant difference (as in noticeable effects on your system) in speed or size between the same driver static or modularized, you are probably deluding yourself.
 
Old 03-23-2006, 11:47 AM   #9
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 7,183

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
When you get an ordinary "distro," it probably has drivers for just about anything and everything that could be on a computer. (DecSystem token-ring cards, anyone?) And it might troll through them; might even load them, leaving them to unload themselves or time-out. A lot of wasted time.

There's also a "hardware check on reboot" that wastes time.

So, you can get rid of the modules you don't need, strip them out of the load-list, and your computer will start up noticeably faster. Turn off the hardware-check too.

Once you have your system "un-gunked" so that it's not carrying around all that weight, the module-load time becomes insignificant.
 
Old 03-24-2006, 02:44 AM   #10
halturata
Member
 
Registered: Aug 2005
Location: Sofia
Distribution: SuSE, ELinOS
Posts: 100

Original Poster
Rep: Reputation: 16
Another luser question: What is "un-gunked"?
 
Old 03-24-2006, 04:21 AM   #11
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86_64; Gentoo PPC; FreeBSD; OS X 10.9.4
Posts: 3,760
Blog Entries: 4

Rep: Reputation: 78
He just means "uncruftulated"...

You know, getting rid of what you don't need.
 
Old 03-24-2006, 03:34 PM   #12
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 52
Quote:
Originally Posted by bulliver

And also, a smaller kernel does not directly translate to faster kernel, rather, one that just takes less space in memory.
i'm not even really sure this is true.
Linux only loads needeed code into memory not whole thing.

the reason in my opinion modules take a little and very little extra resources is the code that keeps track of module useage and checks if a module is still needed.
 
  


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
Loadable Kernel Modules jbrashear Debian 7 04-03-2005 06:11 PM
How does the compile affect performance claudiup Linux - Software 3 12-11-2004 01:21 PM
Loadable modules question dudds Linux - Newbie 5 07-20-2004 03:13 AM
of course I have loadable modules enabled! jmynkbht Linux - Software 0 04-26-2004 04:52 AM
loadable modules vs built-in modules nuzzy Linux - Hardware 1 07-21-2003 05:16 PM


All times are GMT -5. The time now is 02:26 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration