suggest 'make -j2' for SMP machines?

Greg Schafer gschafer at zip.com.au
Mon Jun 4 23:09:53 PDT 2007


Deskin Miller wrote:

> Is this worth adding to the book?

Most definitely IMHO. Multi-core systems will soon be the norm. It's just
crazy not to take advantage. There used to exist a "SMP" hint somewhere.
Maybe this is it:

http://www.linuxfromscratch.org/hints/downloads/files/OLD/parallelcompiling.txt

A lot of seasoned SMP-building folks work on the basis of make -j X+1 ie:
make -j3 if you have 2 cpus or 2 cores. As a person who has been building
in parallel for a long time, I strongly disagree with a comment elsewhere
in this thread about performance plummeting if overutilizing.

> I'm continuing building using make
> -j2, and haven't had any issues with it thus far; if I do discover
> any, I'll be sure to post about it.

For the record, the DIY Refbuild has had optional `make -jX' support for
years. Although I implemented it in a slightly "sledgehammer" fashion by
exporting MAKEFLAGS eg:

export MAKEFLAGS="-j3"

The gotcha with this approach is *ALL* invocations of `make' are affected,
even those for `make install'. This can lead to some interesting failures.
But it's easy enough to work around, just add `-j1' to the "known-to-fail"
cases.

Regards
Greg
-- 
http://www.diy-linux.org/




More information about the lfs-dev mailing list