From c492f2e1913a48a75c241bbbd0112db5fc86d3ca Mon Sep 17 00:00:00 2001 From: Michele Di Giorgio Date: Mon, 20 Nov 2017 11:23:08 +0000 Subject: [PATCH] shutils: consider different hierarchies when running command into cgroups The target platform can have different hierarchies with different cgroup controllers mounted. If we have a cgroup that uses different controllers belonging to different hierarchies, that cgroup will be present under the different hierarchies. Therefore, in such cases we need to take into all those paths having that cgroup and move the task into all of them. --- devlib/bin/scripts/shutils.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/devlib/bin/scripts/shutils.in b/devlib/bin/scripts/shutils.in index a58783b..708dade 100755 --- a/devlib/bin/scripts/shutils.in +++ b/devlib/bin/scripts/shutils.in @@ -124,14 +124,14 @@ cgroups_run_into() { # Check if the required CGroup exists $FIND $CGMOUNT -type d -mindepth 1 | \ - $GREP "$CGP" &>/dev/null + $GREP -E "^$CGMOUNT/devlib_cgh[0-9]{1,2}$CGP" &>/dev/null if [ $? -ne 0 ]; then echo "ERROR: could not find any $CGP cgroup under $CGMOUNT" exit 1 fi $FIND $CGMOUNT -type d -mindepth 1 | \ - $GREP -e "^$CGMOUNT$CGP$" | \ + $GREP -E "^$CGMOUNT/devlib_cgh[0-9]{1,2}$CGP$" | \ while read CGPATH; do # Move this shell into that control group echo $$ > $CGPATH/cgroup.procs