[jhalfs] branch xry111/parallelism updated: Add forgotten run-with-cgroup.sh script
| Newsgroups | gmane.linux.lfs.automated |
|---|---|
| Message-ID | <170007350839.10695.17975978476372006350@rivendell.linuxfromscratch.org> |
This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch xry111/parallelism
in repository jhalfs.
The following commit(s) were added to refs/heads/xry111/parallelism by this push:
new 8e9343b Add forgotten run-with-cgroup.sh script
8e9343b is described below
commit 8e9343b6323ae0792535c13289fc70de2f538c03
Author: Pierre Labastie <[email protected]>
AuthorDate: Wed Nov 15 19:37:58 2023 +0100
Add forgotten run-with-cgroup.sh script
---
common/run-in-cgroup.sh | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/common/run-in-cgroup.sh b/common/run-in-cgroup.sh
new file mode 100755
index 0000000..9891d72
--- /dev/null
+++ b/common/run-in-cgroup.sh
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+if [ -z "$CPUSPEC" ] || [ "$#" -lt 1 ]; then
+ echo "usage: CPUSPEC=... $0 command"
+ exit 1
+fi
+
+set +e
+
+if type systemd-run >/dev/null 2>&1 ; then
+ sudo systemd-run -G --pty -d --uid=$(whoami) -p AllowedCPUs="$CPUSPEC" "$@"
+else
+ sudo mkdir /sys/fs/cgroup/jhalfs
+ sudo sh -c "echo +cpuset > /sys/fs/cgroup/cgroup.subtree_control"
+ sudo sh -c "echo \"$CPUSPEC\" > /sys/fs/cgroup/jhalfs/cpuset.cpus"
+ (sudo sh -c "echo $BASHPID > /sys/fs/cgroup/jhalfs/cgroup.procs" &&
+ exec "$@")
+ sudo rmdir /sys/fs/cgroup/jhalfs
+fi
--
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