Allow users to pass a cpuset

If using a new book, MAKEFLAGS is set to -j$(nproc), so that if
we want to easure timings with 4 processors and our computer has
more than that, we need to restrict the number of processors.
Jhalfs allows to do that using th cpuset cgroup controller, so that
it only restrits the make job and not the whole machine. For that
use a small scripts written by Xi Ruoyao that restarts make this
the cpuset set.
This commit is contained in:
Pierre Labastie 2023-11-15 18:19:14 +01:00
parent 63190e6547
commit cacc6c5433
3 changed files with 13 additions and 1 deletions

View file

@ -302,6 +302,17 @@ build_Makefile() { #
i=`expr $i + 1` i=`expr $i + 1`
done done
# If CPUSET is defined and not equal to "all", then we define a first target
# that calls a script which re-enters make calling target all
if [ -n "$CPUSET" ] && [ "$CPUSET" != all ]; then
(
cat << EOF
all-with-cpuset:
@CPUSPEC="\$(CPUSET)" ./run-in-cgroup \$(MAKE) all
EOF
) >> $MKFILE
fi
# Drop in the main target 'all:' and the chapter targets with each sub-target # Drop in the main target 'all:' and the chapter targets with each sub-target
# as a dependency. Also prevent running targets in parallel. # as a dependency. Also prevent running targets in parallel.
( (

View file

@ -44,6 +44,7 @@ ADD_CUSTOM_TOOLS = $CUSTOM_TOOLS
ADD_BLFS_TOOLS = $BLFS_TOOL ADD_BLFS_TOOLS = $BLFS_TOOL
PKGMNGT = $PKGMNGT PKGMNGT = $PKGMNGT
WRAP_INSTALL = $WRAP_INSTALL WRAP_INSTALL = $WRAP_INSTALL
CPUSET = $CPUSET
export PATH := \${PATH}:/usr/sbin export PATH := \${PATH}:/usr/sbin

2
jhalfs
View file

@ -323,7 +323,7 @@ if [[ "$REBUILD_MAKEFILE" = "n" ]] ; then
true >"$LOGDIR/$LOG" true >"$LOGDIR/$LOG"
# Copy common helper files # Copy common helper files
cp "$COMMON_DIR"/{makefile-functions,progress_bar.sh} "$JHALFSDIR/" cp "$COMMON_DIR"/{makefile-functions,progress_bar.sh,run-in-cgroup.sh} "$JHALFSDIR/"
# Copy needed stylesheets # Copy needed stylesheets
cp "$COMMON_DIR"/{packages.xsl,chroot.xsl,kernfs.xsl} "$JHALFSDIR/" cp "$COMMON_DIR"/{packages.xsl,chroot.xsl,kernfs.xsl} "$JHALFSDIR/"