[jhalfs] 04/05: Allow users to pass a cpuset

"Git Owner" ([email protected] via alfs-discuss Mailing List) <[email protected]>
Newsgroups gmane.linux.lfs.automated
Message-ID <[email protected]>
This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch xry111/parallelism
in repository jhalfs.

commit cacc6c5433c5c2e2b52eee16cb88f661899a2a6f
Author: Pierre Labastie <[email protected]>
AuthorDate: Wed Nov 15 18:19:14 2023 +0100

    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.
---
 LFS/master.sh                 | 11 +++++++++++
 common/libs/func_wrt_Makefile |  1 +
 jhalfs                        |  2 +-
 3 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/LFS/master.sh b/LFS/master.sh
index d28b5cb..8402fc1 100644
--- a/LFS/master.sh
+++ b/LFS/master.sh
@@ -302,6 +302,17 @@ build_Makefile() {           #
     i=`expr $i + 1`
   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
   # as a dependency. Also prevent running targets in parallel.
 (
diff --git a/common/libs/func_wrt_Makefile b/common/libs/func_wrt_Makefile
index 78bb3e1..c694e76 100644
--- a/common/libs/func_wrt_Makefile
+++ b/common/libs/func_wrt_Makefile
@@ -44,6 +44,7 @@ ADD_CUSTOM_TOOLS = $CUSTOM_TOOLS
 ADD_BLFS_TOOLS   = $BLFS_TOOL
 PKGMNGT          = $PKGMNGT
 WRAP_INSTALL     = $WRAP_INSTALL
+CPUSET           = $CPUSET
 
 
 export PATH := \${PATH}:/usr/sbin
diff --git a/jhalfs b/jhalfs
index fe2c30c..9f2518c 100755
--- a/jhalfs
+++ b/jhalfs
@@ -323,7 +323,7 @@ if [[ "$REBUILD_MAKEFILE" = "n" ]] ; then
   true >"$LOGDIR/$LOG"
 
 # 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
   cp "$COMMON_DIR"/{packages.xsl,chroot.xsl,kernfs.xsl} "$JHALFSDIR/"

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

-- 
http://lists.linuxfromscratch.org/sympa/info/alfs-discuss
Unsubscribe: See the above information page
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.