Re: make -j with j <= 4 seems to only load a single CPU core

From: Jesper Juhl
Date: Tue Feb 21 2006 - 16:08:35 EST


On 2/21/06, Jesper Juhl <jesper.juhl@xxxxxxxxx> wrote:
> This is quite odd and I've no idea where to start looking for the
> cause, but let me describe what I'm seeing and maybe someone can point
> me in the right direction.
>
> I'm running SMP 2.6.x kernels on a Athlon 64 X2 4400+
>

I should probably mention that the kernel I'm currently running and
observing this behaviour with is 2.6.16-rc4-mm1.

> When I build new kernels I use 'make -j' to get both CPU cores busy
> and minimize build time.
>
> I've observed that when I use 'make -j 2', 'make -j 3' or 'make -j 4'
> only ~half of my CPU resources get used during the build and when I
> look at the output it looks exactely like output from plain 'make' for
> something like 95% of the build - that is, files get build
> sequentially, not in parallel.
> However, if I run 'make -j 5' or higher, then both cores get lots of
> work to do and utilization of both cores stay close to 100% for almost
> the entire build, and the output during the build shows lots of files
> from different directories intermixed, so it's clearly building stuf
> in parallel.
>
> I find this quite strange since anything from 'make -j 2' and up
> should be able to keep both cores resonably busy, but there seems to
> be a huge difference between j <= 4 and j > 4.
>
> Another datapoint: This is most pronounced when I am also running the
> make process nice'd. Which I usually do in order to be able to use the
> machine for other tasks while the build is in progress.
> If I don't run the build nice'd then it starts to be resonably
> parallel at j >= 3, but still doesn't *really* load both cores before
> j >= 5.
>
>
> Just to be completely clear - a few examples:
>
> This is what I usually run to load both cores well :
>
> nice make -j 5 2>&1 | tee build.log
>
> this however gives me a more or less serial build with only half the
> system resources used :
>
> nice make -j 4 2>&1 | tee build.log
>
> Without nice this loads the box somewhat OK (but not completely):
>
> make -j 3 2>&1 | tee build.log
>
> and this pretty much gives me a serial build:
>
> make -j 2 2>&1 | tee build.log
>
>
> Any good explanations for this behaviour ?
>
>

--
Jesper Juhl <jesper.juhl@xxxxxxxxx>
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please http://www.expita.com/nomime.html
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/