diff options
authorYann E. MORIN <>2013-05-10 03:56:01 (GMT)
committerPeter Korsgaard <>2013-05-11 20:49:59 (GMT)
commitdf8d52fb025b8f48bd34344e2987eba3757f966c (patch)
parent31002cb40323dcc2aa7b6a50b85e5a3c24b2a5d6 (diff)
package-infra: limit the number of // jobs
The current code spawns as many jobs as up to twice the number of CPUs. On small-class machines like laptops, with a limitted amount of memory, but still a few CPUs (real or hyperthreads), the HDD becomes a bottleneck, and it becomes almost impossible to do anythiong else while there is a build in progress. Limit the number of jobs to the number of CPUs plus one. Even on fast machines with fast HDDs, this settings keeps the machine fully busy (for those packages that can build in parallel, of course). For example, building qemu or the linux kernel kept my hyperthreaded hexa Core i7 with 18GiB of RAM, busy at 99% (I never ever managed to get 100% even with more jobs, not even 200); while on my hyperthreaded dual Core i5 with only 4GiB and a slow HDD, I still topped at 100% CPU, while still able to do some work involving the HDD. If the number of processors is not available, assume one. Signed-off-by: "Yann E. MORIN" <> Cc: Nathan Lynch <> Reviewed-by: Thomas Petazzoni <> Reviewed-by: Nathan Lynch <> Signed-off-by: Peter Korsgaard <>
1 files changed, 3 insertions, 2 deletions
diff --git a/package/ b/package/
index a449089..9ba6e8c 100644
--- a/package/
+++ b/package/
@@ -7,11 +7,12 @@ endif
HOSTMAKE :=$(shell which $(HOSTMAKE) || type -p $(HOSTMAKE) || echo make)
# If BR2_LEVEL is 0, scale the maximum concurrency with the number of
-# CPUs. A coefficient of 2 is used in order to keep processors busy
+# CPUs. An additional job is used in order to keep processors busy
# while waiting on I/O.
+# If the number of processors is not available, assume one.
ifeq ($(BR2_JLEVEL),0)
PARALLEL_JOBS:=$(shell echo \
- $$((2 * `getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1`)))
+ $$((1 + `getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1`)))