You are not logged in.

#1 2011-10-26 05:42:49

655321
Member
From: Costa Rica
Registered: 2009-12-08
Posts: 412
Website

What are the benefits of running a custom compiled Kernel?

Hi, I am just curious about this, what extra benefits can I get if I decide to go ahead and compile my own kernel to fit my laptop needs (compared to the one that Arch provides)?

Also, when a new updated kernel is pulled via pacman, will I need to recompile/reconfigure?

How much complexity to the system will this add?

Please don't think I am lazzy, I tried finding this stuff via a web-search but only got TONS of pages explaining HOW to compile and configure it and not the benefits, also I would love an explanation from an Arch user or dev regarding this because well, its on Arch I'm going to do it big_smile

thanks for the help!


Linux user #498977
With microsoft you get windows and gates, with linux you get the whole house!
My Blog about ArchLinux and other stuff

Offline

#2 2011-10-26 05:48:57

/dev/zero
Member
From: Melbourne, Australia
Registered: 2011-10-20
Posts: 1,247

Re: What are the benefits of running a custom compiled Kernel?

I think the standard answer is that it will make the kernel smaller and faster. I think a more important benefit is that it also makes it more stable and secure by reducing possibilities for conflicts or bugs to enter the kernel. Also a custom kernel might implement a feature you need, which isn't in the stock kernel.

Offline

#3 2011-10-26 06:10:46

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

Re: What are the benefits of running a custom compiled Kernel?

There are a few things.  For one, you can optimize the kernel for your CPU(s).  The generic kernel must support all CPUs that fit the architecture (x86 or x86_64).  You may see some improvement by setting the march to your specific processor.  You can then turn off backward compatibility options.

You may want to play with different schedulers.  You may want to enable debug features if you want to hack the kernel.

You can build drivers in to the kernel instead of using them as modules.  This may allow the kernel to load faster.  If you include all the modules you need to boot, you can boot without the use of an initrd.

Also, not all drivers are turned on in the Arch kernel.  If you were, for example, hacking your car's engine computer and needed a CAN driver to talk to it, you would need to enable the CAN drivers.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#4 2011-10-26 21:37:27

655321
Member
From: Costa Rica
Registered: 2009-12-08
Posts: 412
Website

Re: What are the benefits of running a custom compiled Kernel?

And what about the added administration complexity and kernel updates? can I just like export the configuration everytime the kernel gets updated?

thanks for the info so far!


Linux user #498977
With microsoft you get windows and gates, with linux you get the whole house!
My Blog about ArchLinux and other stuff

Offline

#5 2011-10-26 21:51:22

/dev/zero
Member
From: Melbourne, Australia
Registered: 2011-10-20
Posts: 1,247

Re: What are the benefits of running a custom compiled Kernel?

I think it's standard practice to retain the kernel config and store it either in /boot or in each kernel's source directory, so you can re-use the config easily. However, I think newer versions of the kernel sometimes change some of the parameters in the configs, so you might sometimes need to do a little hacking to keep the config up to date.

Offline

#6 2011-10-26 21:59:22

Gusar
Member
Registered: 2009-08-25
Posts: 3,606

Re: What are the benefits of running a custom compiled Kernel?

655321 wrote:

And what about the added administration complexity and kernel updates? can I just like export the configuration everytime the kernel gets updated?

Configuration is stored in the kernel itself (if the option is activated, which it is by default), and is accessible via /proc/config.gz. So when a new kernel is released, you do a

zcat /proc/config.gz > .config

followed by a

make oldconfig

This will apply all your old settings and ask you about the stuff that's new in the new kernel version.

Offline

#7 2011-10-27 04:43:19

sitquietly
Member
From: On the Wolf River
Registered: 2010-07-12
Posts: 220

Re: What are the benefits of running a custom compiled Kernel?

655321 wrote:

Hi, I am just curious about this, what extra benefits can I get if I decide to go ahead and compile my own kernel to fit my laptop needs (compared to the one that Arch provides)?

The biggest reason that I compile the kernel is to get lower latencies. This might mean that I can record audio without missed samples or that I can run a heavy load without seeing artifacts and jerkiness when manipulating windows. Desktop effects appear smooth even when the system is heavily loaded.  I measure latency using the interbench program (available from AUR). As far as I know the linux-ck and linux-lqx kernels inherently have lower latency, and of course compiling for my specific cpu helps too.

For example the latencies for the 3.0.6 stock kernel on my system were

--- Benchmarking simulated cpu of X in the presence of simulated ---
Load	Latency +/- SD (ms)  Max Latency   % Desired CPU  % Deadlines Met
None	   0.0 +/- 0.1        1.0		 100	       99.2
Video	   0.0 +/- 0.1        1.0		 100	       99.2
Burn	  24.7 +/- 39.8     100.0		28.6	       17.2
Write	   0.0 +/- 0.1        1.0		 100	       99.2
Read	   0.0 +/- 0.1        1.0		 100	       99.2
Compile	  26.2 +/- 42.0     112.0		25.1	         15
Memload	   0.0 +/- 0.1        1.0		 100	       99.2

and the latencies for the linux-ck kernel compiled for my core2 cpu were:

--- Benchmarking simulated cpu of X in the presence of simulated ---
Load	Latency +/- SD (ms)  Max Latency   % Desired CPU  % Deadlines Met
None	   0.0 +/- 0.1        1.0		 100	       99.2
Video	   0.0 +/- 0.1        1.0		 100	       99.2
Burn	   4.7 +/- 18.3      97.0		45.4	       42.4
Write	   0.0 +/- 0.1        1.0		 100	       99.2
Read	   0.0 +/- 0.1        1.0		 100	       99.2
Compile	   6.8 +/- 17.1      82.0		  51	       43.2
Memload	   0.0 +/- 0.1        1.0		 100	       99.2

The linux-lqx kernel looked even a little bit better (compiled with the "arch=native" option, which on my sandy bridge system is the same as "arch=corei7-avx"):

--- Benchmarking simulated cpu of X in the presence of simulated ---
Load	Latency +/- SD (ms)  Max Latency   % Desired CPU  % Deadlines Met
None	   0.0 +/- 0.1        1.0		 100	       99.2
Video	   0.0 +/- 0.1        1.0		 100	       99.2
Burn	   3.5 +/- 15.8     100.0		48.8	       46.3
Write	   0.0 +/- 0.1        1.0		 100	       99.2
Read	   0.0 +/- 0.1        1.0		 100	       99.2
Compile	   5.0 +/- 12.6      64.0		57.9	       50.1
Memload	   0.0 +/- 0.2        3.0		99.2	         98

As you can see the benefit is only detectable under heavy load but then the difference can be significant.  The "latency" in X windowing tasks while compiling was reduced from 26.2 ms to 6.8 ms and then to 5.0 ms. Just as importantly the (simulated) compile task got 57.9% (or 51%) of its desired cpu time instead of only 25.1% with the stock kernel.

A custom compiled kernel CAN make your system noticeably more responsive and faster. And it's fun to learn to tweak things big_smile

Last edited by sitquietly (2011-10-27 04:56:06)

Offline

#8 2011-10-31 22:11:34

snufkin
Member
From: Sweden
Registered: 2008-11-08
Posts: 71

Re: What are the benefits of running a custom compiled Kernel?

ewaller wrote:

There are a few things.  For one, you can optimize the kernel for your CPU(s).  The generic kernel must support all CPUs that fit the architecture (x86 or x86_64).  You may see some improvement by setting the march to your specific processor.  You can then turn off backward compatibility options.

You may want to play with different schedulers.  You may want to enable debug features if you want to hack the kernel.

You can build drivers in to the kernel instead of using them as modules.  This may allow the kernel to load faster.  If you include all the modules you need to boot, you can boot without the use of an initrd.

Also, not all drivers are turned on in the Arch kernel.  If you were, for example, hacking your car's engine computer and needed a CAN driver to talk to it, you would need to enable the CAN drivers.

Speaking of this, how do you know which modules to build in to the kernel? Is it enough to look in mkinitcpio.conf and 'translate' the hooks to kernel modules, or are there more needed modules hiding somwhere else?

Last edited by snufkin (2011-10-31 22:11:57)

Offline

#9 2011-11-01 06:50:51

sealemar
Member
Registered: 2011-10-30
Posts: 32

Re: What are the benefits of running a custom compiled Kernel?

you need to see the output of your

lspci
lsusb
lsmod

that will help you to determine what you need to include

Last edited by sealemar (2011-11-01 06:54:37)

Offline

#10 2011-11-13 14:37:29

sealemar
Member
Registered: 2011-10-30
Posts: 32

Re: What are the benefits of running a custom compiled Kernel?

The main benefit of running a custom kernel is to avoid all the troubles that others might have. Please, see my post for an example.

Offline

Board footer

Powered by FluxBB