Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Gentoo kernel compilation time low compared to other distres
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
mattia29
n00b
n00b


Joined: 28 Nov 2015
Posts: 6

PostPosted: Fri Dec 04, 2015 1:22 pm    Post subject: Gentoo kernel compilation time low compared to other distres Reply with quote

Hi everyone,
I'm trying gentoo for the first time in virtual box and initially I was scared by the "famous" long compilation time of gentoo packages. But when it was the time to compile the kernel, I launched the common
Code:
time make & make modules_install

to have an estimate of the needed time. The result was like this:

real: about 9 minutes

Before Gentoo, I tried compiling the kernel on Arch both via AUR and in classical way, and on Ubuntu, also here both in the traditional way and creating the .deb package. On ubuntu I tried also with the vanilla kernel.

The results were about:

Arch (virtualbox): about 1 h 5 minutes 8O
ubuntu (hard disk installation): about 42 minutes 8O

There were no substantial difference between the compilation methods. Everytime I used the [/code]-j4[code] command to use all the cores and I set the kernel simply removing support to amd cpus and unused filesystems (I'm able to do only this at the moment).
The machine is a Macbook Pro 2011 with i5-2415m dual core + hyper threading, 4gb ram.

My question is: why so much difference?

Thank you
Back to top
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1369
Location: Montréal

PostPosted: Fri Dec 04, 2015 2:39 pm    Post subject: Reply with quote

Hello,

did you allow VirtualBox to use all your cpu cores with 100% of their resources in you machine configuration? What was the amount of memory you have allowed it to use compare to the host total? The compiling time would have been probably lower if done from the host.

One possible explanation is that your Gentoo kernel configuration is minimal compare to the ones of the Arch and Ubuntu. Usually, generic kernels have a very complete configuration specially to support the variety of devices they can boot on. So, they take a long time to compile compare a personnalised kernel with only needed support for one machine.
_________________
Paul
Back to top
View user's profile Send private message
mattia29
n00b
n00b


Joined: 28 Nov 2015
Posts: 6

PostPosted: Fri Dec 04, 2015 2:49 pm    Post subject: Reply with quote

Yes, I allow virtual box to always use all cores and for both gentoo and arch the available ram is 1 gb. Ubuntu was installed on hd so it had all 4gb available.
I followed the handbook to install the gentoo kernel (manually, not with genkernel). Do you think there could be so much difference?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 43365
Location: 56N 3W

PostPosted: Fri Dec 04, 2015 7:03 pm    Post subject: Reply with quote

mattia29,

Thu first make will take a long time. Second and subsequent builds are fast as make is lazy.
Each time it finds an output file it is being asked to make, it compares the timestamps of all the input files required to that of the output file.
If the output file is newer, make does nothing for that file.

Run
Code:
make clean
time make & make modules_install
and report your findings.

make clean removes any existing output files, which forces them to be built.
Incidentally. make will only use 1 core.

Code:
make clean
time make -j7 & make modules_install
will run 6 gcc jobs and make itself.

The kernel build can be massively parallel. Do not use make -j with no limit.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
desultory
Administrator
Administrator


Joined: 04 Nov 2005
Posts: 9249

PostPosted: Sat Dec 05, 2015 5:15 am    Post subject: Reply with quote

Moved from Documentation, Tips & Tricks to Kernel & Hardware, though perhaps portage & Programming would fit as well.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13970

PostPosted: Sat Dec 05, 2015 3:33 pm    Post subject: Reply with quote

Very long kernel compile times can be caused by building unneeded features. Distribution kernels are often configured to support every likely user, which can mean shipping support for all the popular network cards, all the popular USB devices, all the popular video cards, etc. This in turn means building a huge volume of code that, in aggregate across all users, is well used, but any particular user may run only a small part of it. A custom configured kernel, whether or not from Gentoo, can include only the things that its operator wants, which can mean building a much smaller volume of code.
Back to top
View user's profile Send private message
desultory
Administrator
Administrator


Joined: 04 Nov 2005
Posts: 9249

PostPosted: Tue Dec 08, 2015 4:52 am    Post subject: Reply with quote

Hu wrote:
Very long kernel compile times can be caused by building unneeded features. Distribution kernels are often configured to support every likely user, which can mean shipping support for all the popular network cards, all the popular USB devices, all the popular video cards, etc. This in turn means building a huge volume of code that, in aggregate across all users, is well used, but any particular user may run only a small part of it. A custom configured kernel, whether or not from Gentoo, can include only the things that its operator wants, which can mean building a much smaller volume of code.
I was thinking along the same lines, but when I re-read the post prior to moving it I thought that should have been controlled for already:
mattia29 wrote:
Everytime I used the [/code]-j4[code] command to use all the cores and I set the kernel simply removing support to amd cpus and unused filesystems (I'm able to do only this at the moment).

Though that would depend on what was being removed from, the default configuration or make allmodconfig, or something else.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13970

PostPosted: Wed Dec 09, 2015 2:15 am    Post subject: Reply with quote

I considered that, but decided to interpret OP's statement as being that he removed support for AMD CPUs and unused filesystems as an exhaustive list of what he removed. If so, then he said nothing about, and possibly never modified, any of the other top level trees, like device drivers, networking support, etc. As you say, it depends on what his baseline was for each side.
Back to top
View user's profile Send private message
mattia29
n00b
n00b


Joined: 28 Nov 2015
Posts: 6

PostPosted: Wed Dec 09, 2015 10:56 am    Post subject: Reply with quote

Sorry for the late reply, I've no time due to work. However I recompiled the kernel under Arch in VM (using
Code:
make clean
before and then
Code:
time make -j4 && make modules_install
), and it took about an hour again. I paid attention to the output and saw a lot of "/drivers/wireless/..." et similia and modules which I didn't see with gentoo. So I think your answer is correct: there are a lot of enabled features which are disabled under gentoo.
Again the only things I've disabled were amd support and uncommon filesystems. I used the kernel 4.3 from kernel.org

Thank you
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum