i am using ubuntu 12.04 . If I build monolithic kernels for device drivers i.e driver will have its own kernel as i understand , will it really improves system performance and device performance ? are there any disadvantages ?
A pedantic note: "monolithic kernel" means something completely different. Linux kernel is always monolithic, regardless of whether some or all of its modules are built as LKMs or compiled directly into the kernel.
When LKMs are loaded into the kernel, there's absolutely no difference in performance compared to built-in modules as LKMs code runs in the same process as the rest of the kernel, there's no inter-process communication or anything.
However, LKMs can be loaded upon request, so if you take the stock-standard Ubuntu kernel and recompile it with all modules built-in, you'll get a humongous kernel which probably will slow the system down because of using much more RAM for all those unused modules (which possibly will also cause all sorts of conflicts with each other).
On the other hand, if you compile a kernel which is custom-tailored to your particular machine and only has the modules for the actual machine's hardware built in, such kernel will likely to be faster than the stock-standard kernel, especially at boot time. I've been playing with a custom kernel for my EeePC on Arch Linux and can report that it's actually noticeably faster:
The downsides, however, are:
All in all, this is a fun and educational exercise but not something I would consider doing on a machine which is not too hardware-restricted.
The only advantage I see at that point is the ability to disable module loading (so even if someone gets root/superuser access they can't load a "bad" module).
That being said, it used to be that you got a small performance hike by disabling unused drivers and compiling in loadable modules. As hardware performance increases, these slight improvements become more and more negligible.
I wanted to chime in here. I used to make only monolithic kernels years ago but the kernel today is pretty advanced using a lot of features. As far as I can tell, it won't let you go 100%. I may be mistaken though.
From what I gather, the kernel will unload modules efficiently allowing your system more memory and resources. For me, I only make things module if it's not important. A USB device, for example, will be a module but my EXT4 is all compiled in. Everything with networking too. In addition, I compile the kernel after I've removed everything that I can and I use some additional methods
First, install all your hardware. It might be a USB device like an iPod or flash drive. Then run this:
That will modify the .config to include all your detected hardware and tick it M.
Xconfig will give you the menu to remove things but be careful. I make my kernel a low latency for desktop and I add support for my hardware specifically.
Finally, the additional features of your CPU can be used if GCC is up to date and you use the following:
That will start the kernel building process using all of the available CPUs to build it, PLUS special support for the AMD Zambezi CPU. Change "bdver1" to match your specific CPU and chance MyKernelVersionNameHere to fit your own kernel naming convention.
In the end is it faster? I think YES. I recompiled the kernel, GCC, WINE and I can play most Windows PC games better in Linux than they play in Windows.