2

I noticed that my processors were, in total, in use only about 50% of the time while making a Linux kernel.

I usually make the kernel, then make the modules.

I have just started a make bzImage in one terminal and a make modules in another and see that both my processors are in full use. I expect the total compile time will be a lot quicker as I'm compiling in parallel instead of serial.

Are there any "gotya's" that make this unsafe?

Stacey Richards
  • 324
  • 4
  • 6

2 Answers2

6

Just use make -j 3 and it should compile in paralell, and will ensure any dependencies are properly handeled, this is the "official" way to do it.

LapTop006
  • 6,466
  • 19
  • 26
  • on a two-core system (50% utilization suggests this) -j 2 would be a better idea. With -j 3, system constantly forced to context changes by enforcing 3 jobs on 2 processor threads. BTW the questioner's correct answer is "make -j 2 bzImage modules" – asdmin Sep 05 '09 at 07:27
  • 2
    @asdmin - Because of the way make does paralellism, with <= 4 cores it's better to do N+1, above that there's not as much benefit as IO becomes the bottleneck. – LapTop006 Sep 05 '09 at 11:36
0

And no, you should not start building two objects in the same directory that are likely to try and compile the same code at the same time.

wzzrd
  • 10,269
  • 2
  • 32
  • 47