[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: need help on "make -j" parameter, it will let the system hung easily

From: Paul Smith
Subject: Re: need help on "make -j" parameter, it will let the system hung easily.
Date: Fri, 14 Dec 2012 09:59:31 -0500

On Fri, 2012-12-14 at 12:45 +0000, Wang, Warner wrote:
> Hello everyone, make experts,
> when I use "make -j" (without specifying a number after it) to compile
> Linux kernel,  it will always make my machine hung, get no response at
> all and the kernel's watchdog (khungtaskd) will complain because there
> are processes in TASK_UNINTERRUPTIBLE status for 120 seconds.  No
> matter I use a HP mainframe with 160 CPU cores, or using a dual-core
> desktop PC, it will always get hung. (my OS is Red Hat Enterprise
> Linux 6)

That seems like an issue with the configuration of your system.  Are you
trying to build the code as root?  Maybe you need to add some per-user

However, the main issue is your use of -j.

> I just want to know is this an expected behavior? Or is this a
> problem?  Or it is an incorrect usage?   Based on the man-page of make
> I don't get any suggestions about the job numbers of make -j
> parameter:
>        -j [jobs], --jobs[=jobs]
>             Specifies the number of jobs (commands) to run
> simultaneously.  If there is more than one -j option, the last  one
> is
>             effective.   If the -j option is given without an
> argument, make will not limit the number of jobs that can run simul-
>             taneously.

This basically says that if you use "-j" with no arguments, make will
run as many jobs as the _makefile_ allows (defined by your prerequisite
rules).  It pays no attention to the limits of your system.

So in an environment (like the Linux kernel) where there are tons of
source files that need to be compiled and they do not depend on each
other, using "-j" with no limit means make will attempt to fork all of
them at the same time.  That could be, in a large codebase, 100's of
compiles all trying to run at the same time.

Typically you would provide an argument with "-j"; usually (assuming you
want to use up the entire system) the number of cores on your system
plus a few (since compiles are mostly CPU but there is some disk I/O
where the CPU will be idle).  The exact number that's optimal for your
build environment (makefiles + hardware) can only be determined by trial
and error.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]