* [LTP] [PATCH] controllers/cpuset:check for cpuset mount status and prefix
@ 2016-07-14 6:54 shuang.qiu
2016-07-22 13:15 ` Jan Stancek
2017-04-20 12:11 ` Cyril Hrubis
0 siblings, 2 replies; 8+ messages in thread
From: shuang.qiu @ 2016-07-14 6:54 UTC (permalink / raw)
To: ltp
From: Shuang Qiu <shuang.qiu@oracle.com>
* Update to handle the env that cpuset subsystem is already mounted
* Similar with commit 6ce94db5bbff0be40813f3fdfe61a55b3186c49a,need to check for cpuset prefix
Signed-off-by: Shuang Qiu <shuang.qiu@oracle.com>
---
.../cpuset_base_ops_testset.sh | 28 +-
.../cpuset_exclusive_test/cpuset_exclusive_test.sh | 168 ++++----
.../kernel/controllers/cpuset/cpuset_funcs.sh | 39 +-
.../cpuset_hierarchy_test/cpuset_hierarchy_test.sh | 416 ++++++++++----------
.../cpuset_hotplug_test/cpuset_hotplug_test.sh | 4 +-
.../cpuset_inherit_test/cpuset_inherit_testset.sh | 12 +-
.../cpuset_memory_pressure_testset.sh | 32 +-
.../cpuset_memory_spread_testset.sh | 2 +-
.../cpuset_memory_test/cpuset_memory_testset.sh | 22 +-
.../cpuset_syscall_test/cpuset_syscall_testset.sh | 8 +-
10 files changed, 369 insertions(+), 362 deletions(-)
diff --git a/testcases/kernel/controllers/cpuset/cpuset_base_ops_test/cpuset_base_ops_testset.sh b/testcases/kernel/controllers/cpuset/cpuset_base_ops_test/cpuset_base_ops_testset.sh
index 63a9dc5..005bcbb 100755
--- a/testcases/kernel/controllers/cpuset/cpuset_base_ops_test/cpuset_base_ops_testset.sh
+++ b/testcases/kernel/controllers/cpuset/cpuset_base_ops_test/cpuset_base_ops_testset.sh
@@ -105,7 +105,7 @@ test_cpus()
cfile_name="cpus"
while read cpus result
do
- base_op_test "$CPUSET/1/cpus" "$cpus" "$result"
+ base_op_test "$CPUSET/1/${PREFIX}cpus" "$cpus" "$result"
done <<- EOF
NULL EMPTY
0 0
@@ -124,15 +124,15 @@ test_cpus()
# while read cpus result
if [ $nr_cpus -ge 3 ]; then
- base_op_test "$CPUSET/1/cpus" "0,1-$((nr_cpus-2)),$((nr_cpus-1))" "0-$((nr_cpus-1))"
- base_op_test "$CPUSET/1/cpus" "0,1-$((nr_cpus-2))," "0-$((nr_cpus-2))"
+ base_op_test "$CPUSET/1/${PREFIX}cpus" "0,1-$((nr_cpus-2)),$((nr_cpus-1))" "0-$((nr_cpus-1))"
+ base_op_test "$CPUSET/1/${PREFIX}cpus" "0,1-$((nr_cpus-2))," "0-$((nr_cpus-2))"
fi
tst_kvercmp2 3 0 0 "RHEL6:2.6.32"
if [ $? -eq 0 ]; then
- base_op_test "$CPUSET/1/cpus" "0-" "WRITE_ERROR"
+ base_op_test "$CPUSET/1/${PREFIX}cpus" "0-" "WRITE_ERROR"
else
- base_op_test "$CPUSET/1/cpus" "0-" "0"
+ base_op_test "$CPUSET/1/${PREFIX}cpus" "0-" "0"
fi
}
@@ -141,7 +141,7 @@ test_mems()
cfile_name="mems"
while read mems result
do
- base_op_test "$CPUSET/1/mems" "$mems" "$result"
+ base_op_test "$CPUSET/1/${PREFIX}mems" "$mems" "$result"
done <<- EOF
NULL EMPTY
0 0
@@ -160,15 +160,15 @@ test_mems()
# while read mems result
if [ $nr_mems -ge 3 ]; then
- base_op_test "$CPUSET/1/mems" "0,1-$((nr_mems-2)),$((nr_mems-1))" "0-$((nr_mems-1))"
- base_op_test "$CPUSET/1/mems" "0,1-$((nr_mems-2))," "0-$((nr_mems-2))"
+ base_op_test "$CPUSET/1/${PREFIX}mems" "0,1-$((nr_mems-2)),$((nr_mems-1))" "0-$((nr_mems-1))"
+ base_op_test "$CPUSET/1/${PREFIX}mems" "0,1-$((nr_mems-2))," "0-$((nr_mems-2))"
fi
tst_kvercmp2 3 0 0 "RHEL6:2.6.32"
if [ $? -eq 0 ]; then
- base_op_test "$CPUSET/1/mems" "0-" "WRITE_ERROR"
+ base_op_test "$CPUSET/1/${PREFIX}mems" "0-" "WRITE_ERROR"
else
- base_op_test "$CPUSET/1/mems" "0-" "0"
+ base_op_test "$CPUSET/1/${PREFIX}mems" "0-" "0"
fi
}
@@ -181,7 +181,7 @@ test_flags()
cfile_name="$filename"
while read flags result
do
- base_op_test "$CPUSET/$filename" "$flags" "$result"
+ base_op_test "$CPUSET/${PREFIX}$filename" "$flags" "$result"
done <<- EOF
NULL 0
0 0
@@ -222,10 +222,10 @@ attach_task_test()
fi
if [ "$cpus" != "NULL" ]; then
- echo $cpus > "$CPUSET/sub_cpuset/cpus"
+ echo $cpus > "$CPUSET/sub_cpuset/${PREFIX}cpus"
fi
if [ "$mems" != "NULL" ]; then
- echo $mems > "$CPUSET/sub_cpuset/mems"
+ echo $mems > "$CPUSET/sub_cpuset/${PREFIX}mems"
fi
cat /dev/zero > /dev/null &
@@ -268,7 +268,7 @@ test_readonly_cfiles()
for filename in cpus mems memory_pressure
do
cfile_name="$filename(READONLY)"
- base_op_test "$CPUSET/$filename" "0" "WRITE_ERROR"
+ base_op_test "$CPUSET/${PREFIX}$filename" "0" "WRITE_ERROR"
done # for filename in readonly cfiles
}
diff --git a/testcases/kernel/controllers/cpuset/cpuset_exclusive_test/cpuset_exclusive_test.sh b/testcases/kernel/controllers/cpuset/cpuset_exclusive_test/cpuset_exclusive_test.sh
index 2188ab6..17e1791 100755
--- a/testcases/kernel/controllers/cpuset/cpuset_exclusive_test/cpuset_exclusive_test.sh
+++ b/testcases/kernel/controllers/cpuset/cpuset_exclusive_test/cpuset_exclusive_test.sh
@@ -35,186 +35,186 @@ exit_status=0
# Case 1-9 test cpus
test1()
{
- echo 0 > "$CPUSET/father/cpu_exclusive" || return 1
- echo 0 > "$CPUSET/father/child/cpu_exclusive" || return 1
+ echo 0 > "$CPUSET/father/${PREFIX}cpu_exclusive" || return 1
+ echo 0 > "$CPUSET/father/child/${PREFIX}cpu_exclusive" || return 1
- test 0 = $(cat "$CPUSET/father/child/cpu_exclusive") || return 1
+ test 0 = $(cat "$CPUSET/father/child/${PREFIX}cpu_exclusive") || return 1
}
test2()
{
- echo 1 > "$CPUSET/father/cpu_exclusive" || return 1
- echo 0 > "$CPUSET/father/child/cpu_exclusive" || return 1
+ echo 1 > "$CPUSET/father/${PREFIX}cpu_exclusive" || return 1
+ echo 0 > "$CPUSET/father/child/${PREFIX}cpu_exclusive" || return 1
- test 0 = $(cat "$CPUSET/father/child/cpu_exclusive") || return 1
+ test 0 = $(cat "$CPUSET/father/child/${PREFIX}cpu_exclusive") || return 1
}
test3()
{
- echo 1 > "$CPUSET/father/cpu_exclusive" || return 1
- echo 1 > "$CPUSET/father/child/cpu_exclusive" || return 1
+ echo 1 > "$CPUSET/father/${PREFIX}cpu_exclusive" || return 1
+ echo 1 > "$CPUSET/father/child/${PREFIX}cpu_exclusive" || return 1
- test 1 = $(cat "$CPUSET/father/child/cpu_exclusive") || return 1
+ test 1 = $(cat "$CPUSET/father/child/${PREFIX}cpu_exclusive") || return 1
}
test4()
{
- echo 0 > "$CPUSET/father/cpu_exclusive" || return 1
- echo 1 > "$CPUSET/father/child/cpu_exclusive" 2> /dev/null && return 1
+ echo 0 > "$CPUSET/father/${PREFIX}cpu_exclusive" || return 1
+ echo 1 > "$CPUSET/father/child/${PREFIX}cpu_exclusive" 2> /dev/null && return 1
- test 0 = $(cat "$CPUSET/father/child/cpu_exclusive") || return 1
+ test 0 = $(cat "$CPUSET/father/child/${PREFIX}cpu_exclusive") || return 1
}
test5()
{
- echo 1 > "$CPUSET/father/cpu_exclusive" || return 1
- echo 1 > "$CPUSET/father/child/cpu_exclusive" || return 1
- echo 0 > "$CPUSET/father/cpu_exclusive" 2> /dev/null && return 1
+ echo 1 > "$CPUSET/father/${PREFIX}cpu_exclusive" || return 1
+ echo 1 > "$CPUSET/father/child/${PREFIX}cpu_exclusive" || return 1
+ echo 0 > "$CPUSET/father/${PREFIX}cpu_exclusive" 2> /dev/null && return 1
- test 1 = $(cat "$CPUSET/father/cpu_exclusive") || return 1
+ test 1 = $(cat "$CPUSET/father/${PREFIX}cpu_exclusive") || return 1
}
test6()
{
- echo 1 > "$CPUSET/father/cpu_exclusive" || return 1
- echo 1 > "$CPUSET/father/child/cpu_exclusive" || return 1
- echo "0-1" > "$CPUSET/father/cpus" || return 1
- echo 0 > "$CPUSET/father/child/cpus" || return 1
+ echo 1 > "$CPUSET/father/${PREFIX}cpu_exclusive" || return 1
+ echo 1 > "$CPUSET/father/child/${PREFIX}cpu_exclusive" || return 1
+ echo "0-1" > "$CPUSET/father/${PREFIX}cpus" || return 1
+ echo 0 > "$CPUSET/father/child/${PREFIX}cpus" || return 1
mkdir "$CPUSET/father/other" || return 1
- echo 1 > "$CPUSET/father/other/cpus" || return 1
+ echo 1 > "$CPUSET/father/other/${PREFIX}cpus" || return 1
- test 0 = $(cat "$CPUSET/father/child/cpus") || return 1
- test 1 = $(cat "$CPUSET/father/other/cpus") || return 1
+ test 0 = $(cat "$CPUSET/father/child/${PREFIX}cpus") || return 1
+ test 1 = $(cat "$CPUSET/father/other/${PREFIX}cpus") || return 1
}
test7()
{
- echo 1 > "$CPUSET/father/cpu_exclusive" || return 1
- echo 1 > "$CPUSET/father/child/cpu_exclusive" || return 1
- echo "0-1" > "$CPUSET/father/cpus" || return 1
- echo 0 > "$CPUSET/father/child/cpus" || return 1
+ echo 1 > "$CPUSET/father/${PREFIX}cpu_exclusive" || return 1
+ echo 1 > "$CPUSET/father/child/${PREFIX}cpu_exclusive" || return 1
+ echo "0-1" > "$CPUSET/father/${PREFIX}cpus" || return 1
+ echo 0 > "$CPUSET/father/child/${PREFIX}cpus" || return 1
mkdir "$CPUSET/father/other" || return 1
- echo "0-1" > "$CPUSET/father/other/cpus" 2> /dev/null && return 1
+ echo "0-1" > "$CPUSET/father/other/${PREFIX}cpus" 2> /dev/null && return 1
- test 0 = $(cat "$CPUSET/father/child/cpus") || return 1
- test -z $(cat "$CPUSET/father/other/cpus") || return 1
+ test 0 = $(cat "$CPUSET/father/child/${PREFIX}cpus") || return 1
+ test -z $(cat "$CPUSET/father/other/${PREFIX}cpus") || return 1
}
test8()
{
- echo 1 > "$CPUSET/father/cpu_exclusive" || return 1
- echo "0-1" > "$CPUSET/father/cpus" || return 1
- echo 0 > "$CPUSET/father/child/cpus" || return 1
+ echo 1 > "$CPUSET/father/${PREFIX}cpu_exclusive" || return 1
+ echo "0-1" > "$CPUSET/father/${PREFIX}cpus" || return 1
+ echo 0 > "$CPUSET/father/child/${PREFIX}cpus" || return 1
mkdir "$CPUSET/father/other" || return 1
- echo 1 > "$CPUSET/father/other/cpus" || return 1
- echo 1 > "$CPUSET/father/child/cpu_exclusive" || return 1
+ echo 1 > "$CPUSET/father/other/${PREFIX}cpus" || return 1
+ echo 1 > "$CPUSET/father/child/${PREFIX}cpu_exclusive" || return 1
- test 1 = $(cat "$CPUSET/father/child/cpu_exclusive") || return 1
+ test 1 = $(cat "$CPUSET/father/child/${PREFIX}cpu_exclusive") || return 1
}
test9()
{
- echo 1 > "$CPUSET/father/cpu_exclusive" || return 1
- echo "0-1" > "$CPUSET/father/cpus" || return 1
- echo 0 > "$CPUSET/father/child/cpus" || return 1
+ echo 1 > "$CPUSET/father/${PREFIX}cpu_exclusive" || return 1
+ echo "0-1" > "$CPUSET/father/${PREFIX}cpus" || return 1
+ echo 0 > "$CPUSET/father/child/${PREFIX}cpus" || return 1
mkdir "$CPUSET/father/other" || return 1
- echo "0-1" > "$CPUSET/father/other/cpus" || return 1
- echo 1 > "$CPUSET/father/child/cpu_exclusive" 2> /dev/null && return 1
+ echo "0-1" > "$CPUSET/father/other/${PREFIX}cpus" || return 1
+ echo 1 > "$CPUSET/father/child/${PREFIX}cpu_exclusive" 2> /dev/null && return 1
- test 0 = $(cat "$CPUSET/father/child/cpu_exclusive") || return 1
+ test 0 = $(cat "$CPUSET/father/child/${PREFIX}cpu_exclusive") || return 1
}
# The following cases test mems
test10()
{
- echo 0 > "$CPUSET/father/mem_exclusive" || return 1
- echo 0 > "$CPUSET/father/child/mem_exclusive" || return 1
+ echo 0 > "$CPUSET/father/${PREFIX}mem_exclusive" || return 1
+ echo 0 > "$CPUSET/father/child/${PREFIX}mem_exclusive" || return 1
- test 0 = $(cat "$CPUSET/father/child/mem_exclusive") || return 1
+ test 0 = $(cat "$CPUSET/father/child/${PREFIX}mem_exclusive") || return 1
}
test11()
{
- echo 1 > "$CPUSET/father/mem_exclusive" || return 1
- echo 0 > "$CPUSET/father/child/mem_exclusive" || return 1
+ echo 1 > "$CPUSET/father/${PREFIX}mem_exclusive" || return 1
+ echo 0 > "$CPUSET/father/child/${PREFIX}mem_exclusive" || return 1
- test 0 = $(cat "$CPUSET/father/child/mem_exclusive") || return 1
+ test 0 = $(cat "$CPUSET/father/child/${PREFIX}mem_exclusive") || return 1
}
test12()
{
- echo 1 > "$CPUSET/father/mem_exclusive" || return 1
- echo 1 > "$CPUSET/father/child/mem_exclusive" || return 1
+ echo 1 > "$CPUSET/father/${PREFIX}mem_exclusive" || return 1
+ echo 1 > "$CPUSET/father/child/${PREFIX}mem_exclusive" || return 1
- test 1 = $(cat "$CPUSET/father/child/mem_exclusive") || return 1
+ test 1 = $(cat "$CPUSET/father/child/${PREFIX}mem_exclusive") || return 1
}
test13()
{
- echo 0 > "$CPUSET/father/mem_exclusive" || return 1
- echo 1 > "$CPUSET/father/child/mem_exclusive" 2> /dev/null && return 1
+ echo 0 > "$CPUSET/father/${PREFIX}mem_exclusive" || return 1
+ echo 1 > "$CPUSET/father/child/${PREFIX}mem_exclusive" 2> /dev/null && return 1
- test 0 = $(cat "$CPUSET/father/child/mem_exclusive") || return 1
+ test 0 = $(cat "$CPUSET/father/child/${PREFIX}mem_exclusive") || return 1
}
test14()
{
- echo 1 > "$CPUSET/father/mem_exclusive" || return 1
- echo 1 > "$CPUSET/father/child/mem_exclusive" || return 1
- echo 0 > "$CPUSET/father/mem_exclusive" 2> /dev/null && return 1
+ echo 1 > "$CPUSET/father/${PREFIX}mem_exclusive" || return 1
+ echo 1 > "$CPUSET/father/child/${PREFIX}mem_exclusive" || return 1
+ echo 0 > "$CPUSET/father/${PREFIX}mem_exclusive" 2> /dev/null && return 1
- test 1 = $(cat "$CPUSET/father/mem_exclusive") || return 1
+ test 1 = $(cat "$CPUSET/father/${PREFIX}mem_exclusive") || return 1
}
test15()
{
- echo 1 > "$CPUSET/father/mem_exclusive" || return 1
- echo 1 > "$CPUSET/father/child/mem_exclusive" || return 1
- echo "0-1" > "$CPUSET/father/mems" || return 1
- echo 0 > "$CPUSET/father/child/mems" || return 1
+ echo 1 > "$CPUSET/father/${PREFIX}mem_exclusive" || return 1
+ echo 1 > "$CPUSET/father/child/${PREFIX}mem_exclusive" || return 1
+ echo "0-1" > "$CPUSET/father/${PREFIX}mems" || return 1
+ echo 0 > "$CPUSET/father/child/${PREFIX}mems" || return 1
mkdir "$CPUSET/father/other" || return 1
- echo 1 > "$CPUSET/father/other/mems" || return 1
+ echo 1 > "$CPUSET/father/other/${PREFIX}mems" || return 1
- test 0 = $(cat "$CPUSET/father/child/mems") || return 1
- test 1 = $(cat "$CPUSET/father/other/mems") || return 1
+ test 0 = $(cat "$CPUSET/father/child/${PREFIX}mems") || return 1
+ test 1 = $(cat "$CPUSET/father/other/${PREFIX}mems") || return 1
}
test16()
{
- echo 1 > "$CPUSET/father/mem_exclusive" || return 1
- echo 1 > "$CPUSET/father/child/mem_exclusive" || return 1
- echo "0-1" > "$CPUSET/father/mems" || return 1
- echo 0 > "$CPUSET/father/child/mems" || return 1
+ echo 1 > "$CPUSET/father/${PREFIX}mem_exclusive" || return 1
+ echo 1 > "$CPUSET/father/child/${PREFIX}mem_exclusive" || return 1
+ echo "0-1" > "$CPUSET/father/${PREFIX}mems" || return 1
+ echo 0 > "$CPUSET/father/child/${PREFIX}mems" || return 1
mkdir "$CPUSET/father/other" || return 1
- echo "0-1" > "$CPUSET/father/other/mems" 2> /dev/null && return 1
+ echo "0-1" > "$CPUSET/father/other/${PREFIX}mems" 2> /dev/null && return 1
- test 0 = $(cat "$CPUSET/father/child/mems") || return 1
- test -z $(cat "$CPUSET/father/other/mems") || return 1
+ test 0 = $(cat "$CPUSET/father/child/${PREFIX}mems") || return 1
+ test -z $(cat "$CPUSET/father/other/${PREFIX}mems") || return 1
}
test17()
{
- echo 1 > "$CPUSET/father/mem_exclusive" || return 1
- echo "0-1" > "$CPUSET/father/mems" || return 1
- echo 0 > "$CPUSET/father/child/mems" || return 1
+ echo 1 > "$CPUSET/father/${PREFIX}mem_exclusive" || return 1
+ echo "0-1" > "$CPUSET/father/${PREFIX}mems" || return 1
+ echo 0 > "$CPUSET/father/child/${PREFIX}mems" || return 1
mkdir "$CPUSET/father/other" || return 1
- echo 1 > "$CPUSET/father/other/mems" || return 1
- echo 1 > "$CPUSET/father/child/mem_exclusive" || return 1
+ echo 1 > "$CPUSET/father/other/${PREFIX}mems" || return 1
+ echo 1 > "$CPUSET/father/child/${PREFIX}mem_exclusive" || return 1
- test 1 = $(cat "$CPUSET/father/child/mem_exclusive") || return 1
+ test 1 = $(cat "$CPUSET/father/child/${PREFIX}mem_exclusive") || return 1
}
test18()
{
- echo 1 > "$CPUSET/father/mem_exclusive" || return 1
- echo "0-1" > "$CPUSET/father/mems" || return 1
- echo 0 > "$CPUSET/father/child/mems" || return 1
+ echo 1 > "$CPUSET/father/${PREFIX}mem_exclusive" || return 1
+ echo "0-1" > "$CPUSET/father/${PREFIX}mems" || return 1
+ echo 0 > "$CPUSET/father/child/${PREFIX}mems" || return 1
mkdir "$CPUSET/father/other" || return 1
- echo "0-1" > "$CPUSET/father/other/mems" || return 1
- echo 1 > "$CPUSET/father/child/mem_exclusive" 2> /dev/null && return 1
+ echo "0-1" > "$CPUSET/father/other/${PREFIX}mems" || return 1
+ echo 1 > "$CPUSET/father/child/${PREFIX}mem_exclusive" 2> /dev/null && return 1
- test 0 = $(cat "$CPUSET/father/child/mem_exclusive") || return 1
+ test 0 = $(cat "$CPUSET/father/child/${PREFIX}mem_exclusive") || return 1
}
for i in $(seq 1 $TST_TOTAL)
diff --git a/testcases/kernel/controllers/cpuset/cpuset_funcs.sh b/testcases/kernel/controllers/cpuset/cpuset_funcs.sh
index cd7000e..72bf8e3 100755
--- a/testcases/kernel/controllers/cpuset/cpuset_funcs.sh
+++ b/testcases/kernel/controllers/cpuset/cpuset_funcs.sh
@@ -35,8 +35,10 @@ fi
N_NODES=${N_NODES#*-*}
N_NODES=$(($N_NODES + 1))
-CPUSET="/dev/cpuset"
+CPUSET=`grep -w cpuset /proc/mounts | cut -f 2 | cut -d " " -f2`
+[ "$CPUSET" == "" ] && CPUSET="/dev/cpuset"
CPUSET_TMP="/tmp/cpuset_tmp"
+[ -e "$CPUSET/cpuset.cpus" ] && PREFIX="cpuset."
HOTPLUG_CPU="1"
@@ -121,19 +123,23 @@ check()
# clean any group created eralier (if any)
setup()
{
- if [ -e "$CPUSET" ]
- then
- tst_resm TWARN "$CPUSET already exist.. overwriting"
- cleanup || tst_brkm TFAIL "Can't cleanup... Exiting"
- fi
-
+ try_mount=0
mkdir -p "$CPUSET_TMP"
- mkdir "$CPUSET"
- mount -t cpuset cpuset "$CPUSET" 2> /dev/null
- if [ $? -ne 0 ]; then
- cleanup
- tst_brkm TFAIL "Could not mount cgroup filesystem with"\
+ if [ "$CPUSET" = "/dev/cpuset" ];then
+ if [ -e "$CPUSET" ]
+ then
+ tst_resm TWARN "$CPUSET already exist.. overwriting"
+ cleanup || tst_brkm TFAIL "Can't cleanup... Exiting"
+ fi
+
+ try_mount=1
+ mkdir "$CPUSET"
+ mount -t cpuset cpuset "$CPUSET" 2> /dev/null
+ if [ $? -ne 0 ]; then
+ cleanup
+ tst_brkm TFAIL "Could not mount cgroup filesystem with"\
" cpuset on $CPUSET..Exiting test"
+ fi
fi
}
@@ -162,13 +168,14 @@ cleanup()
fi
done
+ rm -rf "$CPUSET_TMP" > /dev/null 2>&1
+ [ "$try_mount" -ne 1 ] && return
umount "$CPUSET"
if [ $? -ne 0 ]; then
tst_brkm TFAIL "Couldn't umount cgroup filesystem with"\
" cpuset on $CPUSET..Exiting test"
fi
rmdir "$CPUSET" > /dev/null 2>&1
- rm -rf "$CPUSET_TMP" > /dev/null 2>&1
}
# set the cpuset's parameter
@@ -187,19 +194,19 @@ cpuset_set()
if [ "$path" != "$CPUSET" ]; then
if [ "$cpus" != "-" ]; then
- /bin/echo $cpus > $path/cpus
+ /bin/echo $cpus > $path/${PREFIX}cpus
if [ $? -ne 0 ]; then
return 1
fi
fi
- /bin/echo $mems > $path/mems
+ /bin/echo $mems > $path/${PREFIX}mems
if [ $? -ne 0 ]; then
return 1
fi
fi
- /bin/echo $load_balance > $path/sched_load_balance
+ /bin/echo $load_balance > $path/${PREFIX}sched_load_balance
if [ $? -ne 0 ]; then
return 1
fi
diff --git a/testcases/kernel/controllers/cpuset/cpuset_hierarchy_test/cpuset_hierarchy_test.sh b/testcases/kernel/controllers/cpuset/cpuset_hierarchy_test/cpuset_hierarchy_test.sh
index 61f58fc..5cee570 100755
--- a/testcases/kernel/controllers/cpuset/cpuset_hierarchy_test/cpuset_hierarchy_test.sh
+++ b/testcases/kernel/controllers/cpuset/cpuset_hierarchy_test/cpuset_hierarchy_test.sh
@@ -42,404 +42,404 @@ exit_status=0
test1()
{
- echo > "$CPUSET/father/cpus" || return 1
- echo > "$CPUSET/father/child/cpus" || return 1
+ echo > "$CPUSET/father/${PREFIX}cpus" || return 1
+ echo > "$CPUSET/father/child/${PREFIX}cpus" || return 1
- cpuset_log "father cpus $(cat "$CPUSET/father/cpus")"
- cpuset_log "child cpus $(cat "$CPUSET/father/child/cpus")"
+ cpuset_log "father cpus $(cat "$CPUSET/father/${PREFIX}cpus")"
+ cpuset_log "child cpus $(cat "$CPUSET/father/child/${PREFIX}cpus")"
- test -z "$(cat "$CPUSET/father/cpus")" || return 1
- test -z "$(cat "$CPUSET/father/child/cpus")" || return 1
+ test -z "$(cat "$CPUSET/father/${PREFIX}cpus")" || return 1
+ test -z "$(cat "$CPUSET/father/child/${PREFIX}cpus")" || return 1
}
test2()
{
- echo > "$CPUSET/father/cpus" || return 1
- echo 0 > "$CPUSET/father/child/cpus" 2> /dev/null && return 1
+ echo > "$CPUSET/father/${PREFIX}cpus" || return 1
+ echo 0 > "$CPUSET/father/child/${PREFIX}cpus" 2> /dev/null && return 1
- cpuset_log "father cpus $(cat "$CPUSET/father/cpus")"
- cpuset_log "child cpus $(cat "$CPUSET/father/child/cpus")"
+ cpuset_log "father cpus $(cat "$CPUSET/father/${PREFIX}cpus")"
+ cpuset_log "child cpus $(cat "$CPUSET/father/child/${PREFIX}cpus")"
- test -z "$(cat "$CPUSET/father/cpus")" || return 1
- test -z "$(cat "$CPUSET/father/child/cpus")" || return 1
+ test -z "$(cat "$CPUSET/father/${PREFIX}cpus")" || return 1
+ test -z "$(cat "$CPUSET/father/child/${PREFIX}cpus")" || return 1
}
test3()
{
- echo 0 > "$CPUSET/father/cpus" || return 1
- echo > "$CPUSET/father/child/cpus" || return 1
+ echo 0 > "$CPUSET/father/${PREFIX}cpus" || return 1
+ echo > "$CPUSET/father/child/${PREFIX}cpus" || return 1
- cpuset_log "father cpus $(cat "$CPUSET/father/cpus")"
- cpuset_log "child cpus $(cat "$CPUSET/father/child/cpus")"
+ cpuset_log "father cpus $(cat "$CPUSET/father/${PREFIX}cpus")"
+ cpuset_log "child cpus $(cat "$CPUSET/father/child/${PREFIX}cpus")"
- test 0 = "$(cat "$CPUSET/father/cpus")" || return 1
- test -z "$(cat "$CPUSET/father/child/cpus")" || return 1
+ test 0 = "$(cat "$CPUSET/father/${PREFIX}cpus")" || return 1
+ test -z "$(cat "$CPUSET/father/child/${PREFIX}cpus")" || return 1
}
test4()
{
- echo 0 > "$CPUSET/father/cpus" || return 1
- echo 0 > "$CPUSET/father/child/cpus" || return 1
+ echo 0 > "$CPUSET/father/${PREFIX}cpus" || return 1
+ echo 0 > "$CPUSET/father/child/${PREFIX}cpus" || return 1
- cpuset_log "father cpus $(cat "$CPUSET/father/cpus")"
- cpuset_log "child cpus $(cat "$CPUSET/father/child/cpus")"
+ cpuset_log "father cpus $(cat "$CPUSET/father/${PREFIX}cpus")"
+ cpuset_log "child cpus $(cat "$CPUSET/father/child/${PREFIX}cpus")"
- test 0 = "$(cat "$CPUSET/father/cpus")" || return 1
- test 0 = "$(cat "$CPUSET/father/child/cpus")" || return 1
+ test 0 = "$(cat "$CPUSET/father/${PREFIX}cpus")" || return 1
+ test 0 = "$(cat "$CPUSET/father/child/${PREFIX}cpus")" || return 1
}
test5()
{
- echo 0 > "$CPUSET/father/cpus" || return 1
- echo 1 > "$CPUSET/father/child/cpus" 2> /dev/null && return 1
+ echo 0 > "$CPUSET/father/${PREFIX}cpus" || return 1
+ echo 1 > "$CPUSET/father/child/${PREFIX}cpus" 2> /dev/null && return 1
- cpuset_log "father cpus $(cat "$CPUSET/father/cpus")"
- cpuset_log "child cpus $(cat "$CPUSET/father/child/cpus")"
+ cpuset_log "father cpus $(cat "$CPUSET/father/${PREFIX}cpus")"
+ cpuset_log "child cpus $(cat "$CPUSET/father/child/${PREFIX}cpus")"
- test 0 = "$(cat "$CPUSET/father/cpus")" || return 1
- test -z "$(cat "$CPUSET/father/child/cpus")" || return 1
+ test 0 = "$(cat "$CPUSET/father/${PREFIX}cpus")" || return 1
+ test -z "$(cat "$CPUSET/father/child/${PREFIX}cpus")" || return 1
}
test6()
{
- echo 0 > "$CPUSET/father/cpus" || return 1
- echo 0,1 > "$CPUSET/father/child/cpus" 2> /dev/null && return 1
+ echo 0 > "$CPUSET/father/${PREFIX}cpus" || return 1
+ echo 0,1 > "$CPUSET/father/child/${PREFIX}cpus" 2> /dev/null && return 1
- cpuset_log "father cpus $(cat "$CPUSET/father/cpus")"
- cpuset_log "child cpus $(cat "$CPUSET/father/child/cpus")"
+ cpuset_log "father cpus $(cat "$CPUSET/father/${PREFIX}cpus")"
+ cpuset_log "child cpus $(cat "$CPUSET/father/child/${PREFIX}cpus")"
- test 0 = "$(cat "$CPUSET/father/cpus")" || return 1
- test -z "$(cat "$CPUSET/father/child/cpus")" || return 1
+ test 0 = "$(cat "$CPUSET/father/${PREFIX}cpus")" || return 1
+ test -z "$(cat "$CPUSET/father/child/${PREFIX}cpus")" || return 1
}
test7()
{
- echo "0,1" > "$CPUSET/father/cpus" || return 1
- echo 0 > "$CPUSET/father/child/cpus" || return 1
+ echo "0,1" > "$CPUSET/father/${PREFIX}cpus" || return 1
+ echo 0 > "$CPUSET/father/child/${PREFIX}cpus" || return 1
- cpuset_log "father cpus $(cat "$CPUSET/father/cpus")"
- cpuset_log "child cpus $(cat "$CPUSET/father/child/cpus")"
+ cpuset_log "father cpus $(cat "$CPUSET/father/${PREFIX}cpus")"
+ cpuset_log "child cpus $(cat "$CPUSET/father/child/${PREFIX}cpus")"
- test "0-1" = "$(cat "$CPUSET/father/cpus")" || return 1
- test 0 = "$(cat "$CPUSET/father/child/cpus")" || return 1
+ test "0-1" = "$(cat "$CPUSET/father/${PREFIX}cpus")" || return 1
+ test 0 = "$(cat "$CPUSET/father/child/${PREFIX}cpus")" || return 1
}
test8()
{
- echo "0,1" > "$CPUSET/father/cpus" || return 1
- echo 0 > "$CPUSET/father/child/cpus" || return 1
+ echo "0,1" > "$CPUSET/father/${PREFIX}cpus" || return 1
+ echo 0 > "$CPUSET/father/child/${PREFIX}cpus" || return 1
- cpuset_log "father cpus $(cat "$CPUSET/father/cpus")"
- cpuset_log "child cpus $(cat "$CPUSET/father/child/cpus")"
+ cpuset_log "father cpus $(cat "$CPUSET/father/${PREFIX}cpus")"
+ cpuset_log "child cpus $(cat "$CPUSET/father/child/${PREFIX}cpus")"
- test "0-1" = "$(cat "$CPUSET/father/cpus")" || return 1
- test 0 = "$(cat "$CPUSET/father/child/cpus")" || return 1
+ test "0-1" = "$(cat "$CPUSET/father/${PREFIX}cpus")" || return 1
+ test 0 = "$(cat "$CPUSET/father/child/${PREFIX}cpus")" || return 1
}
test9()
{
- echo "$cpus_all" > "$CPUSET/father/cpus" || return 1
- echo > "$CPUSET/father/child/cpus" || return 1
- echo > "$CPUSET/father/cpus" || return 1
+ echo "$cpus_all" > "$CPUSET/father/${PREFIX}cpus" || return 1
+ echo > "$CPUSET/father/child/${PREFIX}cpus" || return 1
+ echo > "$CPUSET/father/${PREFIX}cpus" || return 1
- cpuset_log "father cpus $(cat "$CPUSET/father/cpus")"
- cpuset_log "child cpus $(cat "$CPUSET/father/child/cpus")"
+ cpuset_log "father cpus $(cat "$CPUSET/father/${PREFIX}cpus")"
+ cpuset_log "child cpus $(cat "$CPUSET/father/child/${PREFIX}cpus")"
- test -z "$(cat "$CPUSET/father/cpus")" || return 1
- test -z "$(cat "$CPUSET/father/child/cpus")" || return 1
+ test -z "$(cat "$CPUSET/father/${PREFIX}cpus")" || return 1
+ test -z "$(cat "$CPUSET/father/child/${PREFIX}cpus")" || return 1
}
test10()
{
- echo "$cpus_all" > "$CPUSET/father/cpus" || return 1
- echo 0 > "$CPUSET/father/child/cpus" || return 1
- echo > "$CPUSET/father/cpus" 2> /dev/null && return 1
+ echo "$cpus_all" > "$CPUSET/father/${PREFIX}cpus" || return 1
+ echo 0 > "$CPUSET/father/child/${PREFIX}cpus" || return 1
+ echo > "$CPUSET/father/${PREFIX}cpus" 2> /dev/null && return 1
- cpuset_log "father cpus $(cat "$CPUSET/father/cpus")"
- cpuset_log "child cpus $(cat "$CPUSET/father/child/cpus")"
+ cpuset_log "father cpus $(cat "$CPUSET/father/${PREFIX}cpus")"
+ cpuset_log "child cpus $(cat "$CPUSET/father/child/${PREFIX}cpus")"
- test "0-$((nr_cpus-1))" = "$(cat "$CPUSET/father/cpus")" || return 1
- test 0 = "$(cat "$CPUSET/father/child/cpus")" || return 1
+ test "0-$((nr_cpus-1))" = "$(cat "$CPUSET/father/${PREFIX}cpus")" || return 1
+ test 0 = "$(cat "$CPUSET/father/child/${PREFIX}cpus")" || return 1
}
test11()
{
- echo "$cpus_all" > "$CPUSET/father/cpus" || return 1
- echo > "$CPUSET/father/child/cpus" || return 1
- echo 0 > "$CPUSET/father/cpus" || return 1
+ echo "$cpus_all" > "$CPUSET/father/${PREFIX}cpus" || return 1
+ echo > "$CPUSET/father/child/${PREFIX}cpus" || return 1
+ echo 0 > "$CPUSET/father/${PREFIX}cpus" || return 1
- cpuset_log "father cpus $(cat "$CPUSET/father/cpus")"
- cpuset_log "child cpus $(cat "$CPUSET/father/child/cpus")"
+ cpuset_log "father cpus $(cat "$CPUSET/father/${PREFIX}cpus")"
+ cpuset_log "child cpus $(cat "$CPUSET/father/child/${PREFIX}cpus")"
- test 0 = "$(cat "$CPUSET/father/cpus")" || return 1
- test -z "$(cat "$CPUSET/father/child/cpus")" || return 1
+ test 0 = "$(cat "$CPUSET/father/${PREFIX}cpus")" || return 1
+ test -z "$(cat "$CPUSET/father/child/${PREFIX}cpus")" || return 1
}
test12()
{
- echo "$cpus_all" > "$CPUSET/father/cpus" || return 1
- echo 0 > "$CPUSET/father/child/cpus" || return 1
- echo 0 > "$CPUSET/father/cpus" || return 1
+ echo "$cpus_all" > "$CPUSET/father/${PREFIX}cpus" || return 1
+ echo 0 > "$CPUSET/father/child/${PREFIX}cpus" || return 1
+ echo 0 > "$CPUSET/father/${PREFIX}cpus" || return 1
- cpuset_log "father cpus $(cat "$CPUSET/father/cpus")"
- cpuset_log "child cpus $(cat "$CPUSET/father/child/cpus")"
+ cpuset_log "father cpus $(cat "$CPUSET/father/${PREFIX}cpus")"
+ cpuset_log "child cpus $(cat "$CPUSET/father/child/${PREFIX}cpus")"
- test 0 = "$(cat "$CPUSET/father/cpus")" || return 1
- test 0 = "$(cat "$CPUSET/father/child/cpus")" || return 1
+ test 0 = "$(cat "$CPUSET/father/${PREFIX}cpus")" || return 1
+ test 0 = "$(cat "$CPUSET/father/child/${PREFIX}cpus")" || return 1
}
test13()
{
- echo "$cpus_all" > "$CPUSET/father/cpus" || return 1
- echo 1 > "$CPUSET/father/child/cpus" || return 1
- echo 0 > "$CPUSET/father/cpus" 2> /dev/null && return 1
+ echo "$cpus_all" > "$CPUSET/father/${PREFIX}cpus" || return 1
+ echo 1 > "$CPUSET/father/child/${PREFIX}cpus" || return 1
+ echo 0 > "$CPUSET/father/${PREFIX}cpus" 2> /dev/null && return 1
- cpuset_log "father cpus $(cat "$CPUSET/father/cpus")"
- cpuset_log "child cpus $(cat "$CPUSET/father/child/cpus")"
+ cpuset_log "father cpus $(cat "$CPUSET/father/${PREFIX}cpus")"
+ cpuset_log "child cpus $(cat "$CPUSET/father/child/${PREFIX}cpus")"
- test "0-$((nr_cpus-1))" = "$(cat "$CPUSET/father/cpus")" || return 1
- test 1 = "$(cat "$CPUSET/father/child/cpus")" || return 1
+ test "0-$((nr_cpus-1))" = "$(cat "$CPUSET/father/${PREFIX}cpus")" || return 1
+ test 1 = "$(cat "$CPUSET/father/child/${PREFIX}cpus")" || return 1
}
test14()
{
- echo "$cpus_all" > "$CPUSET/father/cpus" || return 1
- echo 0,1 > "$CPUSET/father/child/cpus" || return 1
- echo 0 > "$CPUSET/father/cpus" 2> /dev/null && return 1
+ echo "$cpus_all" > "$CPUSET/father/${PREFIX}cpus" || return 1
+ echo 0,1 > "$CPUSET/father/child/${PREFIX}cpus" || return 1
+ echo 0 > "$CPUSET/father/${PREFIX}cpus" 2> /dev/null && return 1
- cpuset_log "father cpus $(cat "$CPUSET/father/cpus")"
- cpuset_log "child cpus $(cat "$CPUSET/father/child/cpus")"
+ cpuset_log "father cpus $(cat "$CPUSET/father/${PREFIX}cpus")"
+ cpuset_log "child cpus $(cat "$CPUSET/father/child/${PREFIX}cpus")"
- test "0-$((nr_cpus-1))" = "$(cat "$CPUSET/father/cpus")" || return 1
- test "0-1" = "$(cat "$CPUSET/father/child/cpus")" || return 1
+ test "0-$((nr_cpus-1))" = "$(cat "$CPUSET/father/${PREFIX}cpus")" || return 1
+ test "0-1" = "$(cat "$CPUSET/father/child/${PREFIX}cpus")" || return 1
}
test15()
{
- echo "$cpus_all" > "$CPUSET/father/cpus" || return 1
- echo 0 > "$CPUSET/father/child/cpus" || return 1
- echo "0,1" > "$CPUSET/father/cpus" || return 1
+ echo "$cpus_all" > "$CPUSET/father/${PREFIX}cpus" || return 1
+ echo 0 > "$CPUSET/father/child/${PREFIX}cpus" || return 1
+ echo "0,1" > "$CPUSET/father/${PREFIX}cpus" || return 1
- cpuset_log "father cpus $(cat "$CPUSET/father/cpus")"
- cpuset_log "child cpus $(cat "$CPUSET/father/child/cpus")"
+ cpuset_log "father cpus $(cat "$CPUSET/father/${PREFIX}cpus")"
+ cpuset_log "child cpus $(cat "$CPUSET/father/child/${PREFIX}cpus")"
- test "0-1" = "$(cat "$CPUSET/father/cpus")" || return 1
- test 0 = "$(cat "$CPUSET/father/child/cpus")" || return 1
+ test "0-1" = "$(cat "$CPUSET/father/${PREFIX}cpus")" || return 1
+ test 0 = "$(cat "$CPUSET/father/child/${PREFIX}cpus")" || return 1
}
test16()
{
- echo "$cpus_all" > "$CPUSET/father/cpus" || return 1
- echo 0 > "$CPUSET/father/child/cpus" || return 1
- echo "0,1" > "$CPUSET/father/cpus" || return 1
+ echo "$cpus_all" > "$CPUSET/father/${PREFIX}cpus" || return 1
+ echo 0 > "$CPUSET/father/child/${PREFIX}cpus" || return 1
+ echo "0,1" > "$CPUSET/father/${PREFIX}cpus" || return 1
- cpuset_log "father cpus $(cat "$CPUSET/father/cpus")"
- cpuset_log "child cpus $(cat "$CPUSET/father/child/cpus")"
+ cpuset_log "father cpus $(cat "$CPUSET/father/${PREFIX}cpus")"
+ cpuset_log "child cpus $(cat "$CPUSET/father/child/${PREFIX}cpus")"
- test "0-1" = "$(cat "$CPUSET/father/cpus")" || return 1
- test 0 = "$(cat "$CPUSET/father/child/cpus")" || return 1
+ test "0-1" = "$(cat "$CPUSET/father/${PREFIX}cpus")" || return 1
+ test 0 = "$(cat "$CPUSET/father/child/${PREFIX}cpus")" || return 1
}
## test mems
test17()
{
- echo > "$CPUSET/father/mems" || return 1
- echo > "$CPUSET/father/child/mems" || return 1
+ echo > "$CPUSET/father/${PREFIX}mems" || return 1
+ echo > "$CPUSET/father/child/${PREFIX}mems" || return 1
- cpuset_log "father mems $(cat "$CPUSET/father/mems")"
- cpuset_log "child mems $(cat "$CPUSET/father/child/mems")"
+ cpuset_log "father mems $(cat "$CPUSET/father/${PREFIX}mems")"
+ cpuset_log "child mems $(cat "$CPUSET/father/child/${PREFIX}mems")"
- test -z "$(cat "$CPUSET/father/mems")" || return 1
- test -z "$(cat "$CPUSET/father/child/mems")" || return 1
+ test -z "$(cat "$CPUSET/father/${PREFIX}mems")" || return 1
+ test -z "$(cat "$CPUSET/father/child/${PREFIX}mems")" || return 1
}
test18()
{
- echo > "$CPUSET/father/mems" || return 1
- echo 0 > "$CPUSET/father/child/mems" 2> /dev/null && return 1
+ echo > "$CPUSET/father/${PREFIX}mems" || return 1
+ echo 0 > "$CPUSET/father/child/${PREFIX}mems" 2> /dev/null && return 1
- cpuset_log "father mems $(cat "$CPUSET/father/mems")"
- cpuset_log "child mems $(cat "$CPUSET/father/child/mems")"
+ cpuset_log "father mems $(cat "$CPUSET/father/${PREFIX}mems")"
+ cpuset_log "child mems $(cat "$CPUSET/father/child/${PREFIX}mems")"
- test -z "$(cat "$CPUSET/father/mems")" || return 1
- test -z "$(cat "$CPUSET/father/child/mems")" || return 1
+ test -z "$(cat "$CPUSET/father/${PREFIX}mems")" || return 1
+ test -z "$(cat "$CPUSET/father/child/${PREFIX}mems")" || return 1
}
test19()
{
- echo 0 > "$CPUSET/father/mems" || return 1
- echo > "$CPUSET/father/child/mems" || return 1
+ echo 0 > "$CPUSET/father/${PREFIX}mems" || return 1
+ echo > "$CPUSET/father/child/${PREFIX}mems" || return 1
- cpuset_log "father mems $(cat "$CPUSET/father/mems")"
- cpuset_log "child mems $(cat "$CPUSET/father/child/mems")"
+ cpuset_log "father mems $(cat "$CPUSET/father/${PREFIX}mems")"
+ cpuset_log "child mems $(cat "$CPUSET/father/child/${PREFIX}mems")"
- test 0 = "$(cat "$CPUSET/father/mems")" || return 1
- test -z "$(cat "$CPUSET/father/child/mems")" || return 1
+ test 0 = "$(cat "$CPUSET/father/${PREFIX}mems")" || return 1
+ test -z "$(cat "$CPUSET/father/child/${PREFIX}mems")" || return 1
}
test20()
{
- echo 0 > "$CPUSET/father/mems" || return 1
- echo 0 > "$CPUSET/father/child/mems" || return 1
+ echo 0 > "$CPUSET/father/${PREFIX}mems" || return 1
+ echo 0 > "$CPUSET/father/child/${PREFIX}mems" || return 1
- cpuset_log "father mems $(cat "$CPUSET/father/mems")"
- cpuset_log "child mems $(cat "$CPUSET/father/child/mems")"
+ cpuset_log "father mems $(cat "$CPUSET/father/${PREFIX}mems")"
+ cpuset_log "child mems $(cat "$CPUSET/father/child/${PREFIX}mems")"
- test 0 = "$(cat "$CPUSET/father/mems")" || return 1
- test 0 = "$(cat "$CPUSET/father/child/mems")" || return 1
+ test 0 = "$(cat "$CPUSET/father/${PREFIX}mems")" || return 1
+ test 0 = "$(cat "$CPUSET/father/child/${PREFIX}mems")" || return 1
}
test21()
{
- echo 0 > "$CPUSET/father/mems" || return 1
- echo 1 > "$CPUSET/father/child/mems" 2> /dev/null && return 1
+ echo 0 > "$CPUSET/father/${PREFIX}mems" || return 1
+ echo 1 > "$CPUSET/father/child/${PREFIX}mems" 2> /dev/null && return 1
- cpuset_log "father mems $(cat "$CPUSET/father/mems")"
- cpuset_log "child mems $(cat "$CPUSET/father/child/mems")"
+ cpuset_log "father mems $(cat "$CPUSET/father/${PREFIX}mems")"
+ cpuset_log "child mems $(cat "$CPUSET/father/child/${PREFIX}mems")"
- test 0 = "$(cat "$CPUSET/father/mems")" || return 1
- test -z "$(cat "$CPUSET/father/child/mems")" || return 1
+ test 0 = "$(cat "$CPUSET/father/${PREFIX}mems")" || return 1
+ test -z "$(cat "$CPUSET/father/child/${PREFIX}mems")" || return 1
}
test22()
{
- echo 0 > "$CPUSET/father/mems" || return 1
- echo 0,1 > "$CPUSET/father/child/mems" 2> /dev/null && return 1
+ echo 0 > "$CPUSET/father/${PREFIX}mems" || return 1
+ echo 0,1 > "$CPUSET/father/child/${PREFIX}mems" 2> /dev/null && return 1
- cpuset_log "father mems $(cat "$CPUSET/father/mems")"
- cpuset_log "child mems $(cat "$CPUSET/father/child/mems")"
+ cpuset_log "father mems $(cat "$CPUSET/father/${PREFIX}mems")"
+ cpuset_log "child mems $(cat "$CPUSET/father/child/${PREFIX}mems")"
- test 0 = "$(cat "$CPUSET/father/mems")" || return 1
- test -z "$(cat "$CPUSET/father/child/mems")" || return 1
+ test 0 = "$(cat "$CPUSET/father/${PREFIX}mems")" || return 1
+ test -z "$(cat "$CPUSET/father/child/${PREFIX}mems")" || return 1
}
test23()
{
- echo "0,1" > "$CPUSET/father/mems" || return 1
- echo 0 > "$CPUSET/father/child/mems" || return 1
+ echo "0,1" > "$CPUSET/father/${PREFIX}mems" || return 1
+ echo 0 > "$CPUSET/father/child/${PREFIX}mems" || return 1
- cpuset_log "father mems $(cat "$CPUSET/father/mems")"
- cpuset_log "child mems $(cat "$CPUSET/father/child/mems")"
+ cpuset_log "father mems $(cat "$CPUSET/father/${PREFIX}mems")"
+ cpuset_log "child mems $(cat "$CPUSET/father/child/${PREFIX}mems")"
- test "0-1" = "$(cat "$CPUSET/father/mems")" || return 1
- test 0 = "$(cat "$CPUSET/father/child/mems")" || return 1
+ test "0-1" = "$(cat "$CPUSET/father/${PREFIX}mems")" || return 1
+ test 0 = "$(cat "$CPUSET/father/child/${PREFIX}mems")" || return 1
}
test24()
{
- echo "0,1" > "$CPUSET/father/mems" || return 1
- echo 0 > "$CPUSET/father/child/mems" || return 1
+ echo "0,1" > "$CPUSET/father/${PREFIX}mems" || return 1
+ echo 0 > "$CPUSET/father/child/${PREFIX}mems" || return 1
- cpuset_log "father mems $(cat "$CPUSET/father/mems")"
- cpuset_log "child mems $(cat "$CPUSET/father/child/mems")"
+ cpuset_log "father mems $(cat "$CPUSET/father/${PREFIX}mems")"
+ cpuset_log "child mems $(cat "$CPUSET/father/child/${PREFIX}mems")"
- test "0-1" = "$(cat "$CPUSET/father/mems")" || return 1
- test 0 = "$(cat "$CPUSET/father/child/mems")" || return 1
+ test "0-1" = "$(cat "$CPUSET/father/${PREFIX}mems")" || return 1
+ test 0 = "$(cat "$CPUSET/father/child/${PREFIX}mems")" || return 1
}
test25()
{
- echo "$mems_all" > "$CPUSET/father/mems" || return 1
- echo > "$CPUSET/father/child/mems" || return 1
- echo > "$CPUSET/father/mems" || return 1
+ echo "$mems_all" > "$CPUSET/father/${PREFIX}mems" || return 1
+ echo > "$CPUSET/father/child/${PREFIX}mems" || return 1
+ echo > "$CPUSET/father/${PREFIX}mems" || return 1
- cpuset_log "father mems $(cat "$CPUSET/father/mems")"
- cpuset_log "child mems $(cat "$CPUSET/father/child/mems")"
+ cpuset_log "father mems $(cat "$CPUSET/father/${PREFIX}mems")"
+ cpuset_log "child mems $(cat "$CPUSET/father/child/${PREFIX}mems")"
- test -z "$(cat "$CPUSET/father/mems")" || return 1
- test -z "$(cat "$CPUSET/father/child/mems")" || return 1
+ test -z "$(cat "$CPUSET/father/${PREFIX}mems")" || return 1
+ test -z "$(cat "$CPUSET/father/child/${PREFIX}mems")" || return 1
}
test26()
{
- echo "$mems_all" > "$CPUSET/father/mems" || return 1
- echo 0 > "$CPUSET/father/child/mems" || return 1
- echo > "$CPUSET/father/mems" 2> /dev/null && return 1
+ echo "$mems_all" > "$CPUSET/father/${PREFIX}mems" || return 1
+ echo 0 > "$CPUSET/father/child/${PREFIX}mems" || return 1
+ echo > "$CPUSET/father/${PREFIX}mems" 2> /dev/null && return 1
- cpuset_log "father mems $(cat "$CPUSET/father/mems")"
- cpuset_log "child mems $(cat "$CPUSET/father/child/mems")"
+ cpuset_log "father mems $(cat "$CPUSET/father/${PREFIX}mems")"
+ cpuset_log "child mems $(cat "$CPUSET/father/child/${PREFIX}mems")"
- test "0-$((nr_mems-1))" = "$(cat "$CPUSET/father/mems")" || return 1
- test 0 = "$(cat "$CPUSET/father/child/mems")" || return 1
+ test "0-$((nr_mems-1))" = "$(cat "$CPUSET/father/${PREFIX}mems")" || return 1
+ test 0 = "$(cat "$CPUSET/father/child/${PREFIX}mems")" || return 1
}
test27()
{
- echo "$mems_all" > "$CPUSET/father/mems" || return 1
- echo > "$CPUSET/father/child/mems" || return 1
- echo 0 > "$CPUSET/father/mems" || return 1
+ echo "$mems_all" > "$CPUSET/father/${PREFIX}mems" || return 1
+ echo > "$CPUSET/father/child/${PREFIX}mems" || return 1
+ echo 0 > "$CPUSET/father/${PREFIX}mems" || return 1
- cpuset_log "father mems $(cat "$CPUSET/father/mems")"
- cpuset_log "child mems $(cat "$CPUSET/father/child/mems")"
+ cpuset_log "father mems $(cat "$CPUSET/father/${PREFIX}mems")"
+ cpuset_log "child mems $(cat "$CPUSET/father/child/${PREFIX}mems")"
- test 0 = "$(cat "$CPUSET/father/mems")" || return 1
- test -z "$(cat "$CPUSET/father/child/mems")" || return 1
+ test 0 = "$(cat "$CPUSET/father/${PREFIX}mems")" || return 1
+ test -z "$(cat "$CPUSET/father/child/${PREFIX}mems")" || return 1
}
test28()
{
- echo "$mems_all" > "$CPUSET/father/mems" || return 1
- echo 0 > "$CPUSET/father/child/mems" || return 1
- echo 0 > "$CPUSET/father/mems" || return 1
+ echo "$mems_all" > "$CPUSET/father/${PREFIX}mems" || return 1
+ echo 0 > "$CPUSET/father/child/${PREFIX}mems" || return 1
+ echo 0 > "$CPUSET/father/${PREFIX}mems" || return 1
- cpuset_log "father mems $(cat "$CPUSET/father/mems")"
- cpuset_log "child mems $(cat "$CPUSET/father/child/mems")"
+ cpuset_log "father mems $(cat "$CPUSET/father/${PREFIX}mems")"
+ cpuset_log "child mems $(cat "$CPUSET/father/child/${PREFIX}mems")"
- test 0 = "$(cat "$CPUSET/father/mems")" || return 1
- test 0 = "$(cat "$CPUSET/father/child/mems")" || return 1
+ test 0 = "$(cat "$CPUSET/father/${PREFIX}mems")" || return 1
+ test 0 = "$(cat "$CPUSET/father/child/${PREFIX}mems")" || return 1
}
test29()
{
- echo "$mems_all" > "$CPUSET/father/mems" || return 1
- echo 1 > "$CPUSET/father/child/mems" || return 1
- echo 0 > "$CPUSET/father/mems" 2> /dev/null && return 1
+ echo "$mems_all" > "$CPUSET/father/${PREFIX}mems" || return 1
+ echo 1 > "$CPUSET/father/child/${PREFIX}mems" || return 1
+ echo 0 > "$CPUSET/father/${PREFIX}mems" 2> /dev/null && return 1
- cpuset_log "father mems $(cat "$CPUSET/father/mems")"
- cpuset_log "child mems $(cat "$CPUSET/father/child/mems")"
+ cpuset_log "father mems $(cat "$CPUSET/father/${PREFIX}mems")"
+ cpuset_log "child mems $(cat "$CPUSET/father/child/${PREFIX}mems")"
- test "0-$((nr_mems-1))" = "$(cat "$CPUSET/father/mems")" || return 1
- test 1 = "$(cat "$CPUSET/father/child/mems")" || return 1
+ test "0-$((nr_mems-1))" = "$(cat "$CPUSET/father/${PREFIX}mems")" || return 1
+ test 1 = "$(cat "$CPUSET/father/child/${PREFIX}mems")" || return 1
}
test30()
{
- echo "$mems_all" > "$CPUSET/father/mems" || return 1
- echo 0,1 > "$CPUSET/father/child/mems" || return 1
- echo 0 > "$CPUSET/father/mems" 2> /dev/null && return 1
+ echo "$mems_all" > "$CPUSET/father/${PREFIX}mems" || return 1
+ echo 0,1 > "$CPUSET/father/child/${PREFIX}mems" || return 1
+ echo 0 > "$CPUSET/father/${PREFIX}mems" 2> /dev/null && return 1
- cpuset_log "father mems $(cat "$CPUSET/father/mems")"
- cpuset_log "child mems $(cat "$CPUSET/father/child/mems")"
+ cpuset_log "father mems $(cat "$CPUSET/father/${PREFIX}mems")"
+ cpuset_log "child mems $(cat "$CPUSET/father/child/${PREFIX}mems")"
- test "0-$((nr_mems-1))" = "$(cat "$CPUSET/father/mems")" || return 1
- test "0-1" = "$(cat "$CPUSET/father/child/mems")" || return 1
+ test "0-$((nr_mems-1))" = "$(cat "$CPUSET/father/${PREFIX}mems")" || return 1
+ test "0-1" = "$(cat "$CPUSET/father/child/${PREFIX}mems")" || return 1
}
test31()
{
- echo "$mems_all" > "$CPUSET/father/mems" || return 1
- echo 0 > "$CPUSET/father/child/mems" || return 1
- echo "0,1" > "$CPUSET/father/mems" || return 1
+ echo "$mems_all" > "$CPUSET/father/${PREFIX}mems" || return 1
+ echo 0 > "$CPUSET/father/child/${PREFIX}mems" || return 1
+ echo "0,1" > "$CPUSET/father/${PREFIX}mems" || return 1
- cpuset_log "father mems $(cat "$CPUSET/father/mems")"
- cpuset_log "child mems $(cat "$CPUSET/father/child/mems")"
+ cpuset_log "father mems $(cat "$CPUSET/father/${PREFIX}mems")"
+ cpuset_log "child mems $(cat "$CPUSET/father/child/${PREFIX}mems")"
- test "0-1" = "$(cat "$CPUSET/father/mems")" || return 1
- test 0 = "$(cat "$CPUSET/father/child/mems")" || return 1
+ test "0-1" = "$(cat "$CPUSET/father/${PREFIX}mems")" || return 1
+ test 0 = "$(cat "$CPUSET/father/child/${PREFIX}mems")" || return 1
}
test32()
{
- echo "$mems_all" > "$CPUSET/father/mems" || return 1
- echo 0 > "$CPUSET/father/child/mems" || return 1
- echo "0,1" > "$CPUSET/father/mems" || return 1
+ echo "$mems_all" > "$CPUSET/father/${PREFIX}mems" || return 1
+ echo 0 > "$CPUSET/father/child/${PREFIX}mems" || return 1
+ echo "0,1" > "$CPUSET/father/${PREFIX}mems" || return 1
- cpuset_log "father mems $(cat "$CPUSET/father/mems")"
- cpuset_log "child mems $(cat "$CPUSET/father/child/mems")"
+ cpuset_log "father mems $(cat "$CPUSET/father/${PREFIX}mems")"
+ cpuset_log "child mems $(cat "$CPUSET/father/child/${PREFIX}mems")"
- test "0-1" = "$(cat "$CPUSET/father/mems")" || return 1
- test 0 = "$(cat "$CPUSET/father/child/mems")" || return 1
+ test "0-1" = "$(cat "$CPUSET/father/${PREFIX}mems")" || return 1
+ test 0 = "$(cat "$CPUSET/father/child/${PREFIX}mems")" || return 1
}
for i in $(seq 1 $TST_TOTAL)
diff --git a/testcases/kernel/controllers/cpuset/cpuset_hotplug_test/cpuset_hotplug_test.sh b/testcases/kernel/controllers/cpuset/cpuset_hotplug_test/cpuset_hotplug_test.sh
index 05a9ea6..936dc14 100755
--- a/testcases/kernel/controllers/cpuset/cpuset_hotplug_test/cpuset_hotplug_test.sh
+++ b/testcases/kernel/controllers/cpuset/cpuset_hotplug_test/cpuset_hotplug_test.sh
@@ -86,7 +86,7 @@ root_cpu_hotplug_test()
return 1
fi
- root_cpus="`cat $CPUSET/cpus`"
+ root_cpus="`cat $CPUSET/${PREFIX}cpus`"
task_cpus="`cat /proc/$tst_pid/status | grep Cpus_allowed_list`"
task_cpus="`echo $task_cpus | sed -e 's/Cpus_allowed_list: //'`"
@@ -155,7 +155,7 @@ general_cpu_hotplug_test()
return 1
fi
- cpus="`cat $path/cpus`"
+ cpus="`cat $path/${PREFIX}cpus`"
task_cpus="`cat /proc/$tst_pid/status | grep Cpus_allowed_list`"
task_cpus="`echo $task_cpus | sed -e 's/Cpus_allowed_list: //'`"
diff --git a/testcases/kernel/controllers/cpuset/cpuset_inherit_test/cpuset_inherit_testset.sh b/testcases/kernel/controllers/cpuset/cpuset_inherit_test/cpuset_inherit_testset.sh
index f9d524e..a90e109 100755
--- a/testcases/kernel/controllers/cpuset/cpuset_inherit_test/cpuset_inherit_testset.sh
+++ b/testcases/kernel/controllers/cpuset/cpuset_inherit_test/cpuset_inherit_testset.sh
@@ -105,7 +105,7 @@ test_cpus()
cfile_name="cpus"
while read cpus result
do
- inherit_test "$CPUSET/1/cpus" "$cpus" "$result"
+ inherit_test "$CPUSET/1/${PREFIX}cpus" "$cpus" "$result"
done <<- EOF
NULL EMPTY
0 EMPTY
@@ -119,7 +119,7 @@ test_mems()
cfile_name="mems"
while read mems result
do
- inherit_test "$CPUSET/1/mems" "$mems" "$result"
+ inherit_test "$CPUSET/1/${PREFIX}mems" "$mems" "$result"
done <<- EOF
NULL EMPTY
0 EMPTY
@@ -137,7 +137,7 @@ test_three_result_similar_flags()
cfile_name="$filename"
while read flags result
do
- inherit_test "$CPUSET/1/$filename" "$flags" "$result"
+ inherit_test "$CPUSET/1/${PREFIX}$filename" "$flags" "$result"
done <<- EOF
0 0
1 0
@@ -154,7 +154,7 @@ test_spread_flags()
cfile_name="$filename"
while read flags result
do
- inherit_test "$CPUSET/1/$filename" "$flags" "$result"
+ inherit_test "$CPUSET/1/${PREFIX}$filename" "$flags" "$result"
done <<- EOF
0 0
1 1
@@ -168,7 +168,7 @@ test_sched_load_balance_flag()
cfile_name="sched_load_balance"
while read flag result
do
- inherit_test "$CPUSET/1/sched_load_balance" "$flag" "$result"
+ inherit_test "$CPUSET/1/${PREFIX}sched_load_balance" "$flag" "$result"
done <<- EOF
0 1
1 1
@@ -181,7 +181,7 @@ test_domain()
cfile_name="sched_relax_domain_level"
while read domain_level result
do
- inherit_test "$CPUSET/1/sched_relax_domain_level" "$domain_level" "$result"
+ inherit_test "$CPUSET/1/${PREFIX}sched_relax_domain_level" "$domain_level" "$result"
done <<- EOF
-1 -1
0 -1
diff --git a/testcases/kernel/controllers/cpuset/cpuset_memory_pressure_test/cpuset_memory_pressure_testset.sh b/testcases/kernel/controllers/cpuset/cpuset_memory_pressure_test/cpuset_memory_pressure_testset.sh
index fcf00d4..775ac2d 100755
--- a/testcases/kernel/controllers/cpuset/cpuset_memory_pressure_test/cpuset_memory_pressure_testset.sh
+++ b/testcases/kernel/controllers/cpuset/cpuset_memory_pressure_test/cpuset_memory_pressure_testset.sh
@@ -43,7 +43,7 @@ usemem=$((py_mem - 20))
test1()
{
- echo 0 > "$CPUSET/memory_pressure_enabled" 2> $CPUSET_TMP/stderr
+ echo 0 > "$CPUSET/${PREFIX}memory_pressure_enabled" 2> $CPUSET_TMP/stderr
if [ $? -ne 0 ]; then
cpuset_log_error $CPUSET_TMP/stderr
tst_resm TFAIL "Closing memory_pressure_enabled failed."
@@ -53,7 +53,7 @@ test1()
local i
for i in $(seq 0 9)
do
- if [ $(cat "$CPUSET/memory_pressure") -ne 0 ]; then
+ if [ $(cat "$CPUSET/${PREFIX}memory_pressure") -ne 0 ]; then
tst_resm TFAIL "Memory_pressure had memory pressure rate."
return 1
fi
@@ -62,7 +62,7 @@ test1()
test2()
{
- echo 0 > "$CPUSET/memory_pressure_enabled" 2> $CPUSET_TMP/stderr
+ echo 0 > "$CPUSET/${PREFIX}memory_pressure_enabled" 2> $CPUSET_TMP/stderr
if [ $? -ne 0 ]; then
cpuset_log_error $CPUSET_TMP/stderr
tst_resm TFAIL "Closing memory_pressure_enabled failed."
@@ -74,7 +74,7 @@ test2()
local i
for i in $(seq 0 9)
do
- if [ $(cat "$CPUSET/memory_pressure") -ne 0 ]; then
+ if [ $(cat "$CPUSET/${PREFIX}memory_pressure") -ne 0 ]; then
tst_resm TFAIL "Memory_pressure had memory pressure rate."
return 1
fi
@@ -83,7 +83,7 @@ test2()
test3()
{
- echo 1 > "$CPUSET/memory_pressure_enabled" 2> $CPUSET_TMP/stderr
+ echo 1 > "$CPUSET/${PREFIX}memory_pressure_enabled" 2> $CPUSET_TMP/stderr
if [ $? -ne 0 ]; then
cpuset_log_error $CPUSET_TMP/stderr
tst_resm TFAIL "Opening memory_pressure_enabled failed."
@@ -100,11 +100,11 @@ test3()
local i
for i in $(seq 0 9)
do
- if [ $(cat "$CPUSET/memory_pressure") -ne 0 ]; then
+ if [ $(cat "$CPUSET/${PREFIX}memory_pressure") -ne 0 ]; then
tst_resm TFAIL "root group's memory_pressure had memory pressure rate."
return 1
fi
- if [ $(cat "$CPUSET/sub_cpuset/memory_pressure") -ne 0 ]; then
+ if [ $(cat "$CPUSET/sub_cpuset/${PREFIX}memory_pressure") -ne 0 ]; then
tst_resm TFAIL "sub group's memory_pressure had memory pressure rate."
return 1
fi
@@ -114,7 +114,7 @@ test3()
test4()
{
- echo 1 > "$CPUSET/memory_pressure_enabled" 2> $CPUSET_TMP/stderr
+ echo 1 > "$CPUSET/${PREFIX}memory_pressure_enabled" 2> $CPUSET_TMP/stderr
if [ $? -ne 0 ]; then
cpuset_log_error $CPUSET_TMP/stderr
tst_resm TFAIL "Opening memory_pressure_enabled failed."
@@ -147,11 +147,11 @@ test4()
local i
for i in $(seq 0 9)
do
- if [ $(cat "$CPUSET/memory_pressure") -ne 0 ]; then
+ if [ $(cat "$CPUSET/${PREFIX}memory_pressure") -ne 0 ]; then
tst_resm TFAIL "root group's memory_pressure had memory pressure rate."
return 1
fi
- if [ $(cat "$CPUSET/sub_cpuset/memory_pressure") -eq 0 ]; then
+ if [ $(cat "$CPUSET/sub_cpuset/${PREFIX}memory_pressure") -eq 0 ]; then
tst_resm TFAIL "sub group's memory_pressure didn't have memory pressure rate."
return 1
fi
@@ -160,7 +160,7 @@ test4()
test5()
{
- echo 1 > "$CPUSET/memory_pressure_enabled" 2> $CPUSET_TMP/stderr
+ echo 1 > "$CPUSET/${PREFIX}memory_pressure_enabled" 2> $CPUSET_TMP/stderr
if [ $? -ne 0 ]; then
cpuset_log_error $CPUSET_TMP/stderr
tst_resm TFAIL "Opening memory_pressure_enabled failed."
@@ -178,11 +178,11 @@ test5()
local i
for i in $(seq 0 9)
do
- if [ $(cat "$CPUSET/memory_pressure") -eq 0 ]; then
+ if [ $(cat "$CPUSET/${PREFIX}memory_pressure") -eq 0 ]; then
tst_resm TFAIL "root group's memory_pressure didn't have memory pressure rate."
return 1
fi
- if [ $(cat "$CPUSET/sub_cpuset/memory_pressure") -ne 0 ]; then
+ if [ $(cat "$CPUSET/sub_cpuset/${PREFIX}memory_pressure") -ne 0 ]; then
tst_resm TFAIL "sub group's memory_pressure had memory pressure rate."
return 1
fi
@@ -191,7 +191,7 @@ test5()
test6()
{
- echo 1 > "$CPUSET/memory_pressure_enabled" 2> $CPUSET_TMP/stderr
+ echo 1 > "$CPUSET/${PREFIX}memory_pressure_enabled" 2> $CPUSET_TMP/stderr
if [ $? -ne 0 ]; then
cpuset_log_error $CPUSET_TMP/stderr
tst_resm TFAIL "Opening memory_pressure_enabled failed."
@@ -224,11 +224,11 @@ test6()
local i
for i in $(seq 0 9)
do
- if [ $(cat "$CPUSET/memory_pressure") -eq 0 ]; then
+ if [ $(cat "$CPUSET/${PREFIX}memory_pressure") -eq 0 ]; then
tst_resm TFAIL "root group's memory_pressure didn't have memory pressure rate."
return 1
fi
- if [ $(cat "$CPUSET/sub_cpuset/memory_pressure") -eq 0 ]; then
+ if [ $(cat "$CPUSET/sub_cpuset/${PREFIX}memory_pressure") -eq 0 ]; then
tst_resm TFAIL "sub group's memory_pressure didn't have memory pressure rate."
return 1
fi
diff --git a/testcases/kernel/controllers/cpuset/cpuset_memory_spread_test/cpuset_memory_spread_testset.sh b/testcases/kernel/controllers/cpuset/cpuset_memory_spread_test/cpuset_memory_spread_testset.sh
index f7d4d63..439e07c 100755
--- a/testcases/kernel/controllers/cpuset/cpuset_memory_spread_test/cpuset_memory_spread_testset.sh
+++ b/testcases/kernel/controllers/cpuset/cpuset_memory_spread_test/cpuset_memory_spread_testset.sh
@@ -207,7 +207,7 @@ general_memory_spread_test()
return 1
fi
- /bin/echo "$is_spread" > "$cpusetpath/memory_spread_page" 2> $CPUSET_TMP/stderr
+ /bin/echo "$is_spread" > "$cpusetpath/${PREFIX}memory_spread_page" 2> $CPUSET_TMP/stderr
if [ $? -ne 0 ]; then
cpuset_log_error $CPUSET_TMP/stderr
tst_resm TFAIL "set spread value failed."
diff --git a/testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_testset.sh b/testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_testset.sh
index e8ef6bf..5360047 100755
--- a/testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_testset.sh
+++ b/testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_testset.sh
@@ -345,7 +345,7 @@ test11()
return 1
fi
- echo 1 > "$CPUSET/2/memory_migrate" 2> $CPUSET_TMP/stderr
+ echo 1 > "$CPUSET/2/${PREFIX}memory_migrate" 2> $CPUSET_TMP/stderr
if [ $? -ne 0 ]; then
cpuset_log_error $CPUSET_TMP/stderr
tst_resm TFAIL "set general group2's memory_migrate failed."
@@ -384,7 +384,7 @@ talk2memory_test_for_case_12_13()
echo $1 > "$2/tasks"
/bin/kill -s SIGUSR1 $1
- echo 0 > "$2/mems" || return 1
+ echo 0 > "$2/${PREFIX}mems" || return 1
sleep 1
/bin/kill -s SIGUSR1 $1
sleep 1
@@ -432,7 +432,7 @@ test13()
return 1
fi
- echo 1 > "$CPUSET/0/memory_migrate" 2> $CPUSET_TMP/stderr
+ echo 1 > "$CPUSET/0/${PREFIX}memory_migrate" 2> $CPUSET_TMP/stderr
if [ $? -ne 0 ]; then
cpuset_log_error $CPUSET_TMP/stderr
tst_resm TFAIL "set general group's memory_migrate failed."
@@ -543,7 +543,7 @@ test15()
return 1
fi
- echo 1 > "$CPUSET/2/memory_migrate" 2> $CPUSET_TMP/stderr
+ echo 1 > "$CPUSET/2/${PREFIX}memory_migrate" 2> $CPUSET_TMP/stderr
if [ $? -ne 0 ]; then
cpuset_log_error $CPUSET_TMP/stderr
tst_resm TFAIL "set general group2's memory_migrate failed."
@@ -599,7 +599,7 @@ test16()
return 1
fi
- echo 1 > "$CPUSET/2/memory_migrate" 2> $CPUSET_TMP/stderr
+ echo 1 > "$CPUSET/2/${PREFIX}memory_migrate" 2> $CPUSET_TMP/stderr
if [ $? -ne 0 ]; then
cpuset_log_error $CPUSET_TMP/stderr
tst_resm TFAIL "set general group2's memory_migrate failed."
@@ -618,7 +618,7 @@ test16()
echo $testtid > "$CPUSET/2/tasks"
sleep 1
- echo 1 > "$CPUSET/1/memory_migrate"
+ echo 1 > "$CPUSET/1/${PREFIX}memory_migrate"
sleep 1
/bin/kill -s SIGUSR2 $testpid
sleep 1
@@ -666,7 +666,7 @@ test17()
return 1
fi
- echo 1 > "$CPUSET/2/memory_migrate" 2> $CPUSET_TMP/stderr
+ echo 1 > "$CPUSET/2/${PREFIX}memory_migrate" 2> $CPUSET_TMP/stderr
if [ $? -ne 0 ]; then
cpuset_log_error $CPUSET_TMP/stderr
tst_resm TFAIL "set general group2's memory_migrate failed."
@@ -684,7 +684,7 @@ test17()
echo $testtid > "$CPUSET/2/tasks"
sleep 1
- echo 0 > "$CPUSET/1/mems"
+ echo 0 > "$CPUSET/1/${PREFIX}mems"
sleep 1
/bin/kill -s SIGUSR2 $testpid
sleep 1
@@ -734,7 +734,7 @@ test18()
return 1
fi
- echo 1 > "$CPUSET/1/memory_migrate" 2> $CPUSET_TMP/stderr
+ echo 1 > "$CPUSET/1/${PREFIX}memory_migrate" 2> $CPUSET_TMP/stderr
if [ $? -ne 0 ]; then
cpuset_log_error $CPUSET_TMP/stderr
tst_resm TFAIL "set general group1's memory_migrate failed."
@@ -748,7 +748,7 @@ test18()
return 1
fi
- echo 1 > "$CPUSET/2/memory_migrate" 2> $CPUSET_TMP/stderr
+ echo 1 > "$CPUSET/2/${PREFIX}memory_migrate" 2> $CPUSET_TMP/stderr
if [ $? -ne 0 ]; then
cpuset_log_error $CPUSET_TMP/stderr
tst_resm TFAIL "set general group2's memory_migrate failed."
@@ -766,7 +766,7 @@ test18()
echo $testtid > "$CPUSET/2/tasks"
sleep 1
- echo 0 > "$CPUSET/1/mems"
+ echo 0 > "$CPUSET/1/${PREFIX}mems"
sleep 1
/bin/kill -s SIGUSR2 $testpid
sleep 1
diff --git a/testcases/kernel/controllers/cpuset/cpuset_syscall_test/cpuset_syscall_testset.sh b/testcases/kernel/controllers/cpuset/cpuset_syscall_test/cpuset_syscall_testset.sh
index 94b8824..faba230 100755
--- a/testcases/kernel/controllers/cpuset/cpuset_syscall_test/cpuset_syscall_testset.sh
+++ b/testcases/kernel/controllers/cpuset/cpuset_syscall_test/cpuset_syscall_testset.sh
@@ -57,14 +57,14 @@ do_syscall_test()
tst_resm TFAIL "mkdir -p $TEST_CPUSET fail."
return 1
fi
- echo "$1" > "$TEST_CPUSET/cpus"
+ echo "$1" > "$TEST_CPUSET/${PREFIX}cpus"
if [ $? -ne 0 ]; then
- tst_resm TFAIL "set $TEST_CPUSET/cpus as $1 fail."
+ tst_resm TFAIL "set $TEST_CPUSET/${PREFIX}cpus as $1 fail."
return 1
fi
- echo "$2" > "$TEST_CPUSET/mems"
+ echo "$2" > "$TEST_CPUSET/${PREFIX}mems"
if [ $? -ne 0 ]; then
- tst_resm TFAIL "set $TEST_CPUSET/mems as $2 fail."
+ tst_resm TFAIL "set $TEST_CPUSET/${PREFIX}mems as $2 fail."
return 1
fi
cpuset_syscall_test $3 >"$TEST_OUTPUT" &
--
1.7.9.5
^ permalink raw reply related [flat|nested] 8+ messages in thread* [LTP] [PATCH] controllers/cpuset:check for cpuset mount status and prefix
2016-07-14 6:54 [LTP] [PATCH] controllers/cpuset:check for cpuset mount status and prefix shuang.qiu
@ 2016-07-22 13:15 ` Jan Stancek
2016-07-23 23:34 ` Shuang Qiu
2017-04-11 6:32 ` charishma
2017-04-20 12:11 ` Cyril Hrubis
1 sibling, 2 replies; 8+ messages in thread
From: Jan Stancek @ 2016-07-22 13:15 UTC (permalink / raw)
To: ltp
----- Original Message -----
> From: "shuang qiu" <shuang.qiu@oracle.com>
> To: ltp@lists.linux.it
> Sent: Thursday, 14 July, 2016 8:54:00 AM
> Subject: [LTP] [PATCH] controllers/cpuset:check for cpuset mount status and prefix
>
> From: Shuang Qiu <shuang.qiu@oracle.com>
>
> * Update to handle the env that cpuset subsystem is already mounted
I'm assuming motivation here are systemd distros, that have memory
cgroup already mounted.
>
> * Similar with commit 6ce94db5bbff0be40813f3fdfe61a55b3186c49a,need to check
> for cpuset prefix
>
> Signed-off-by: Shuang Qiu <shuang.qiu@oracle.com>
> ---
> .../cpuset_base_ops_testset.sh | 28 +-
> .../cpuset_exclusive_test/cpuset_exclusive_test.sh | 168 ++++----
> .../kernel/controllers/cpuset/cpuset_funcs.sh | 39 +-
> .../cpuset_hierarchy_test/cpuset_hierarchy_test.sh | 416
> ++++++++++----------
> .../cpuset_hotplug_test/cpuset_hotplug_test.sh | 4 +-
> .../cpuset_inherit_test/cpuset_inherit_testset.sh | 12 +-
> .../cpuset_memory_pressure_testset.sh | 32 +-
> .../cpuset_memory_spread_testset.sh | 2 +-
> .../cpuset_memory_test/cpuset_memory_testset.sh | 22 +-
> .../cpuset_syscall_test/cpuset_syscall_testset.sh | 8 +-
> 10 files changed, 369 insertions(+), 362 deletions(-)
Looks OK to me. The changes look straight-forward, there's just
lot of them.
I've ran it on RHEL7.3 and these passed. I tried also upstream
4.7-rc7 and there were some failures, but that seems to be
because some input validation has changed on some files.
Can you also mention where/how you tested this change?
Thanks,
Jan
^ permalink raw reply [flat|nested] 8+ messages in thread
* [LTP] [PATCH] controllers/cpuset:check for cpuset mount status and prefix
2016-07-22 13:15 ` Jan Stancek
@ 2016-07-23 23:34 ` Shuang Qiu
2017-04-11 6:32 ` charishma
1 sibling, 0 replies; 8+ messages in thread
From: Shuang Qiu @ 2016-07-23 23:34 UTC (permalink / raw)
To: ltp
On 07/22/2016 09:15 PM, Jan Stancek wrote:
>
>
>
> ----- Original Message -----
>> From: "shuang qiu" <shuang.qiu@oracle.com>
>> To: ltp@lists.linux.it
>> Sent: Thursday, 14 July, 2016 8:54:00 AM
>> Subject: [LTP] [PATCH] controllers/cpuset:check for cpuset mount status and prefix
>>
>> From: Shuang Qiu <shuang.qiu@oracle.com>
>>
>> * Update to handle the env that cpuset subsystem is already mounted
> I'm assuming motivation here are systemd distros, that have memory
> cgroup already mounted.
Yes,such like RHEL7 or OL7,it is mounted by default.
But also another scenario that on RHEL6 or OL6 with cgconfig service
running.
>
>> * Similar with commit 6ce94db5bbff0be40813f3fdfe61a55b3186c49a,need to check
>> for cpuset prefix
>>
>> Signed-off-by: Shuang Qiu <shuang.qiu@oracle.com>
>> ---
>> .../cpuset_base_ops_testset.sh | 28 +-
>> .../cpuset_exclusive_test/cpuset_exclusive_test.sh | 168 ++++----
>> .../kernel/controllers/cpuset/cpuset_funcs.sh | 39 +-
>> .../cpuset_hierarchy_test/cpuset_hierarchy_test.sh | 416
>> ++++++++++----------
>> .../cpuset_hotplug_test/cpuset_hotplug_test.sh | 4 +-
>> .../cpuset_inherit_test/cpuset_inherit_testset.sh | 12 +-
>> .../cpuset_memory_pressure_testset.sh | 32 +-
>> .../cpuset_memory_spread_testset.sh | 2 +-
>> .../cpuset_memory_test/cpuset_memory_testset.sh | 22 +-
>> .../cpuset_syscall_test/cpuset_syscall_testset.sh | 8 +-
>> 10 files changed, 369 insertions(+), 362 deletions(-)
> Looks OK to me. The changes look straight-forward, there's just
> lot of them.
>
> I've ran it on RHEL7.3 and these passed. I tried also upstream
> 4.7-rc7 and there were some failures, but that seems to be
> because some input validation has changed on some files.
>
> Can you also mention where/how you tested this change?
I just tested on OL7.2 and OL6.8 with cgconfig service start or stop.
There were also some failures but not related with mount or prefix,I'm
still checking them.
Thanks for review
Shuang
>
> Thanks,
> Jan
^ permalink raw reply [flat|nested] 8+ messages in thread
* [LTP] [PATCH] controllers/cpuset:check for cpuset mount status and prefix
2016-07-22 13:15 ` Jan Stancek
2016-07-23 23:34 ` Shuang Qiu
@ 2017-04-11 6:32 ` charishma
2017-04-18 10:00 ` Jan Stancek
1 sibling, 1 reply; 8+ messages in thread
From: charishma @ 2017-04-11 6:32 UTC (permalink / raw)
To: ltp
On 07/22/2016 06:45 PM, Jan Stancek wrote:
>
>
>
> ----- Original Message -----
>> From: "shuang qiu" <shuang.qiu@oracle.com>
>> To: ltp@lists.linux.it
>> Sent: Thursday, 14 July, 2016 8:54:00 AM
>> Subject: [LTP] [PATCH] controllers/cpuset:check for cpuset mount status and prefix
>>
>> From: Shuang Qiu <shuang.qiu@oracle.com>
>>
>> * Update to handle the env that cpuset subsystem is already mounted
> I'm assuming motivation here are systemd distros, that have memory
> cgroup already mounted.
>
I have tested with this patch on my RHEL7.3 system,and all tests passed.
Can this patch be pulled to upstream ?
>> * Similar with commit 6ce94db5bbff0be40813f3fdfe61a55b3186c49a,need to check
>> for cpuset prefix
>>
>> Signed-off-by: Shuang Qiu <shuang.qiu@oracle.com>
>> ---
>> .../cpuset_base_ops_testset.sh | 28 +-
>> .../cpuset_exclusive_test/cpuset_exclusive_test.sh | 168 ++++----
>> .../kernel/controllers/cpuset/cpuset_funcs.sh | 39 +-
>> .../cpuset_hierarchy_test/cpuset_hierarchy_test.sh | 416
>> ++++++++++----------
>> .../cpuset_hotplug_test/cpuset_hotplug_test.sh | 4 +-
>> .../cpuset_inherit_test/cpuset_inherit_testset.sh | 12 +-
>> .../cpuset_memory_pressure_testset.sh | 32 +-
>> .../cpuset_memory_spread_testset.sh | 2 +-
>> .../cpuset_memory_test/cpuset_memory_testset.sh | 22 +-
>> .../cpuset_syscall_test/cpuset_syscall_testset.sh | 8 +-
>> 10 files changed, 369 insertions(+), 362 deletions(-)
> Looks OK to me. The changes look straight-forward, there's just
> lot of them.
>
> I've ran it on RHEL7.3 and these passed. I tried also upstream
> 4.7-rc7 and there were some failures, but that seems to be
> because some input validation has changed on some files.
> Can you also mention where/how you tested this change?
>
> Thanks,
> Jan
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [LTP] [PATCH] controllers/cpuset:check for cpuset mount status and prefix
2017-04-11 6:32 ` charishma
@ 2017-04-18 10:00 ` Jan Stancek
2017-04-20 12:15 ` Cyril Hrubis
0 siblings, 1 reply; 8+ messages in thread
From: Jan Stancek @ 2017-04-18 10:00 UTC (permalink / raw)
To: ltp
> >> * Update to handle the env that cpuset subsystem is already mounted
> > I'm assuming motivation here are systemd distros, that have memory
> > cgroup already mounted.
> >
> I have tested with this patch on my RHEL7.3 system,and all tests passed.
> Can this patch be pulled to upstream ?
Cyril,
any objections to the patch?
I noticed one issue, but it's not related to this patch:
/opt/ltp/testcases/bin/cpuset_base_ops_testset.sh: line 131: tst_kvercmp2: command not found
/opt/ltp/testcases/bin/cpuset_base_ops_testset.sh: line 167: tst_kvercmp2: command not found
Regards,
Jan
^ permalink raw reply [flat|nested] 8+ messages in thread
* [LTP] [PATCH] controllers/cpuset:check for cpuset mount status and prefix
2017-04-18 10:00 ` Jan Stancek
@ 2017-04-20 12:15 ` Cyril Hrubis
0 siblings, 0 replies; 8+ messages in thread
From: Cyril Hrubis @ 2017-04-20 12:15 UTC (permalink / raw)
To: ltp
Hi!
> any objections to the patch?
I looked at the patchset and pointed out some minor issues. Looks good
to me if these are fixed.
> I noticed one issue, but it's not related to this patch:
> /opt/ltp/testcases/bin/cpuset_base_ops_testset.sh: line 131: tst_kvercmp2: command not found
> /opt/ltp/testcases/bin/cpuset_base_ops_testset.sh: line 167: tst_kvercmp2: command not found
Ah, my bad, that is a leftover from the commit that removed the
tst_kvercmp* binaries. I will look into fixing it.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 8+ messages in thread
* [LTP] [PATCH] controllers/cpuset:check for cpuset mount status and prefix
2016-07-14 6:54 [LTP] [PATCH] controllers/cpuset:check for cpuset mount status and prefix shuang.qiu
2016-07-22 13:15 ` Jan Stancek
@ 2017-04-20 12:11 ` Cyril Hrubis
2017-04-22 8:30 ` Shuang Qiu
1 sibling, 1 reply; 8+ messages in thread
From: Cyril Hrubis @ 2017-04-20 12:11 UTC (permalink / raw)
To: ltp
Hi!
> diff --git a/testcases/kernel/controllers/cpuset/cpuset_funcs.sh b/testcases/kernel/controllers/cpuset/cpuset_funcs.sh
> index cd7000e..72bf8e3 100755
> --- a/testcases/kernel/controllers/cpuset/cpuset_funcs.sh
> +++ b/testcases/kernel/controllers/cpuset/cpuset_funcs.sh
> @@ -35,8 +35,10 @@ fi
> N_NODES=${N_NODES#*-*}
> N_NODES=$(($N_NODES + 1))
>
> -CPUSET="/dev/cpuset"
> +CPUSET=`grep -w cpuset /proc/mounts | cut -f 2 | cut -d " " -f2`
The 'cut -f 2' does not seem to have any efect here, moreover single awk
command should do the same:
CPUSET=$(awk '/cpuset/ {print $2}' /proc/mounts)
> +[ "$CPUSET" == "" ] && CPUSET="/dev/cpuset"
> CPUSET_TMP="/tmp/cpuset_tmp"
> +[ -e "$CPUSET/cpuset.cpus" ] && PREFIX="cpuset."
Shouldn't we do this check in the setup after we mounted the cpuset (in
a case that it wasn't mounted)?
> HOTPLUG_CPU="1"
>
> @@ -121,19 +123,23 @@ check()
> # clean any group created eralier (if any)
> setup()
> {
> - if [ -e "$CPUSET" ]
> - then
> - tst_resm TWARN "$CPUSET already exist.. overwriting"
> - cleanup || tst_brkm TFAIL "Can't cleanup... Exiting"
> - fi
> -
> + try_mount=0
> mkdir -p "$CPUSET_TMP"
> - mkdir "$CPUSET"
> - mount -t cpuset cpuset "$CPUSET" 2> /dev/null
> - if [ $? -ne 0 ]; then
> - cleanup
> - tst_brkm TFAIL "Could not mount cgroup filesystem with"\
> + if [ "$CPUSET" = "/dev/cpuset" ];then
> + if [ -e "$CPUSET" ]
> + then
> + tst_resm TWARN "$CPUSET already exist.. overwriting"
> + cleanup || tst_brkm TFAIL "Can't cleanup... Exiting"
> + fi
The coding style in this part is inconsistent, ideally you should stick
to the style used in the rest of the file and consistently use:
if foo; then
...
fi
> + try_mount=1
> + mkdir "$CPUSET"
> + mount -t cpuset cpuset "$CPUSET" 2> /dev/null
> + if [ $? -ne 0 ]; then
> + cleanup
> + tst_brkm TFAIL "Could not mount cgroup filesystem with"\
> " cpuset on $CPUSET..Exiting test"
> + fi
We should set the try_mount after the mount here since otherwise we will
try to umount it in the cleanup if the mount here has failed.
Also it try_mount is not a good name for the flag. It should be rather
called moutned instead.
> fi
> }
>
> @@ -162,13 +168,14 @@ cleanup()
> fi
> done
>
> + rm -rf "$CPUSET_TMP" > /dev/null 2>&1
> + [ "$try_mount" -ne 1 ] && return
> umount "$CPUSET"
> if [ $? -ne 0 ]; then
> tst_brkm TFAIL "Couldn't umount cgroup filesystem with"\
> " cpuset on $CPUSET..Exiting test"
> fi
> rmdir "$CPUSET" > /dev/null 2>&1
> - rm -rf "$CPUSET_TMP" > /dev/null 2>&1
> }
The rest of the patchset looks obviously correct.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 8+ messages in thread* [LTP] [PATCH] controllers/cpuset:check for cpuset mount status and prefix
2017-04-20 12:11 ` Cyril Hrubis
@ 2017-04-22 8:30 ` Shuang Qiu
0 siblings, 0 replies; 8+ messages in thread
From: Shuang Qiu @ 2017-04-22 8:30 UTC (permalink / raw)
To: ltp
Hi Cyril,
Thank you for review.
I agree all your comment and will update the patch.
Thanks
Shuang
On 04/20/2017 08:11 PM, Cyril Hrubis wrote:
> Hi!
>> diff --git a/testcases/kernel/controllers/cpuset/cpuset_funcs.sh b/testcases/kernel/controllers/cpuset/cpuset_funcs.sh
>> index cd7000e..72bf8e3 100755
>> --- a/testcases/kernel/controllers/cpuset/cpuset_funcs.sh
>> +++ b/testcases/kernel/controllers/cpuset/cpuset_funcs.sh
>> @@ -35,8 +35,10 @@ fi
>> N_NODES=${N_NODES#*-*}
>> N_NODES=$(($N_NODES + 1))
>>
>> -CPUSET="/dev/cpuset"
>> +CPUSET=`grep -w cpuset /proc/mounts | cut -f 2 | cut -d " " -f2`
> The 'cut -f 2' does not seem to have any efect here, moreover single awk
> command should do the same:
>
> CPUSET=$(awk '/cpuset/ {print $2}' /proc/mounts)
>
>> +[ "$CPUSET" == "" ] && CPUSET="/dev/cpuset"
>> CPUSET_TMP="/tmp/cpuset_tmp"
>> +[ -e "$CPUSET/cpuset.cpus" ] && PREFIX="cpuset."
> Shouldn't we do this check in the setup after we mounted the cpuset (in
> a case that it wasn't mounted)?
>
>> HOTPLUG_CPU="1"
>>
>> @@ -121,19 +123,23 @@ check()
>> # clean any group created eralier (if any)
>> setup()
>> {
>> - if [ -e "$CPUSET" ]
>> - then
>> - tst_resm TWARN "$CPUSET already exist.. overwriting"
>> - cleanup || tst_brkm TFAIL "Can't cleanup... Exiting"
>> - fi
>> -
>> + try_mount=0
>> mkdir -p "$CPUSET_TMP"
>> - mkdir "$CPUSET"
>> - mount -t cpuset cpuset "$CPUSET" 2> /dev/null
>> - if [ $? -ne 0 ]; then
>> - cleanup
>> - tst_brkm TFAIL "Could not mount cgroup filesystem with"\
>> + if [ "$CPUSET" = "/dev/cpuset" ];then
>> + if [ -e "$CPUSET" ]
>> + then
>> + tst_resm TWARN "$CPUSET already exist.. overwriting"
>> + cleanup || tst_brkm TFAIL "Can't cleanup... Exiting"
>> + fi
> The coding style in this part is inconsistent, ideally you should stick
> to the style used in the rest of the file and consistently use:
>
> if foo; then
> ...
> fi
>
>> + try_mount=1
>> + mkdir "$CPUSET"
>> + mount -t cpuset cpuset "$CPUSET" 2> /dev/null
>> + if [ $? -ne 0 ]; then
>> + cleanup
>> + tst_brkm TFAIL "Could not mount cgroup filesystem with"\
>> " cpuset on $CPUSET..Exiting test"
>> + fi
> We should set the try_mount after the mount here since otherwise we will
> try to umount it in the cleanup if the mount here has failed.
>
> Also it try_mount is not a good name for the flag. It should be rather
> called moutned instead.
>
>> fi
>> }
>>
>> @@ -162,13 +168,14 @@ cleanup()
>> fi
>> done
>>
>> + rm -rf "$CPUSET_TMP" > /dev/null 2>&1
>> + [ "$try_mount" -ne 1 ] && return
>> umount "$CPUSET"
>> if [ $? -ne 0 ]; then
>> tst_brkm TFAIL "Couldn't umount cgroup filesystem with"\
>> " cpuset on $CPUSET..Exiting test"
>> fi
>> rmdir "$CPUSET" > /dev/null 2>&1
>> - rm -rf "$CPUSET_TMP" > /dev/null 2>&1
>> }
> The rest of the patchset looks obviously correct.
>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-04-22 8:30 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-14 6:54 [LTP] [PATCH] controllers/cpuset:check for cpuset mount status and prefix shuang.qiu
2016-07-22 13:15 ` Jan Stancek
2016-07-23 23:34 ` Shuang Qiu
2017-04-11 6:32 ` charishma
2017-04-18 10:00 ` Jan Stancek
2017-04-20 12:15 ` Cyril Hrubis
2017-04-20 12:11 ` Cyril Hrubis
2017-04-22 8:30 ` Shuang Qiu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox