build: add a config option for passing the top-level make jobserver to packages that have parallel build enabled, significantly improves parallelization and gets rid of CPU overcommit during intra-package parallel builds

SVN-Revision: 33414
master
Felix Fietkau 12 years ago
parent ed14ffc7da
commit be6f437649
  1. 11
      Config.in
  2. 8
      include/package.mk
  3. 2
      include/toplevel.mk

@ -311,12 +311,21 @@ menu "Global build settings"
If you are unsure, select N. If you are unsure, select N.
config PKG_BUILD_USE_JOBSERVER
bool
prompt "Use top-level make jobserver for packages"
depends on PKG_BUILD_PARALLEL
default y
help
This passes the main make process jobserver fds to package builds,
enabling full parallelization across different packages
config PKG_BUILD_JOBS config PKG_BUILD_JOBS
int int
prompt "Number of package submake jobs (2-512)" prompt "Number of package submake jobs (2-512)"
range 2 512 range 2 512
default 2 default 2
depends on PKG_BUILD_PARALLEL depends on PKG_BUILD_PARALLEL && !PKG_BUILD_USE_JOBSERVER
help help
The number of jobs (-jX) to pass to packages submake. The number of jobs (-jX) to pass to packages submake.

@ -15,11 +15,17 @@ PKG_MD5SUM ?= unknown
PKG_BUILD_PARALLEL ?= PKG_BUILD_PARALLEL ?=
PKG_INFO_DIR := $(STAGING_DIR)/pkginfo PKG_INFO_DIR := $(STAGING_DIR)/pkginfo
ifneq ($(CONFIG_PKG_BUILD_USE_JOBSERVER),)
MAKE_J:=$(MAKE_JOBSERVER)
else
MAKE_J:=-j$(CONFIG_PKG_BUILD_JOBS)
endif
ifeq ($(strip $(PKG_BUILD_PARALLEL)),0) ifeq ($(strip $(PKG_BUILD_PARALLEL)),0)
PKG_JOBS?=-j1 PKG_JOBS?=-j1
else else
PKG_JOBS?=$(if $(PKG_BUILD_PARALLEL)$(CONFIG_PKG_DEFAULT_PARALLEL),\ PKG_JOBS?=$(if $(PKG_BUILD_PARALLEL)$(CONFIG_PKG_DEFAULT_PARALLEL),\
$(if $(CONFIG_PKG_BUILD_PARALLEL),-j$(CONFIG_PKG_BUILD_JOBS),-j1),-j1) $(if $(CONFIG_PKG_BUILD_PARALLEL),$(MAKE_J),-j1),-j1)
endif endif
include $(INCLUDE_DIR)/prereq.mk include $(INCLUDE_DIR)/prereq.mk

@ -148,7 +148,7 @@ prereq:: prepare-tmpinfo .config
echo "WARNING: your configuration is out of sync. Please run make menuconfig, oldconfig or defconfig!"; \ echo "WARNING: your configuration is out of sync. Please run make menuconfig, oldconfig or defconfig!"; \
fi \ fi \
) )
@+$(SUBMAKE) -r $@ @+$(SUBMAKE) -r $@ MAKE_JOBSERVER="$(filter --jobserver% -j,$(MAKEFLAGS))"
help: help:
cat README cat README

Loading…
Cancel
Save