controllers/cpuset:check for cpuset mount status and prefix
PATCH 1/1 controllers/cpuset:check for cpuset mount status and prefix
From: Shuang Qiu <[email protected]>
* Update to handle the env that cpuset subsystem is already mounted
* Similar with commit 6ce94db5bbff0be40813f3fdfe61a55b3186c49a,need to check for cpuset prefix
--- .../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(-)
testcases/kernel/controllers/cpuset/cpuset_base_ops_test/cpuset_base_ops_testset.sh +14 -14
@@ -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 }
testcases/kernel/controllers/cpuset/cpuset_exclusive_test/cpuset_exclusive_test.sh +84 -84
270 lines not on this page · raw message
testcases/kernel/controllers/cpuset/cpuset_funcs.sh +23 -16
@@ -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
testcases/kernel/controllers/cpuset/cpuset_hierarchy_test/cpuset_hierarchy_test.sh +208 -208
612 lines not on this page · raw message
testcases/kernel/controllers/cpuset/cpuset_hotplug_test/cpuset_hotplug_test.sh +2 -2
@@ -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: //'`"
testcases/kernel/controllers/cpuset/cpuset_inherit_test/cpuset_inherit_testset.sh +6 -6
@@ -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
testcases/kernel/controllers/cpuset/cpuset_memory_pressure_test/cpuset_memory_pressure_testset.sh +16 -16
@@ -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
testcases/kernel/controllers/cpuset/cpuset_memory_spread_test/cpuset_memory_spread_testset.sh +1 -1
@@ -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."
testcases/kernel/controllers/cpuset/cpuset_memory_test/cpuset_memory_testset.sh +11 -11
@@ -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
testcases/kernel/controllers/cpuset/cpuset_syscall_test/cpuset_syscall_testset.sh +4 -4
@@ -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" &
Signature · 1 line
1.7.9.5
PATCH 1/1 controllers/cpuset:check for cpuset mount status and prefix
----- Original Message -----
Quoted 8 lines
From: "shuang qiu" <[email protected]>
To: [email protected]
Sent: Thursday, 14 July, 2016 8:54:00 AM
Subject: [LTP] [PATCH] controllers/cpuset:check for cpuset mount status and prefixFrom: Shuang Qiu <[email protected]>
* 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.
Quoted 5 lines
* Similar with commit 6ce94db5bbff0be40813f3fdfe61a55b3186c49a,need to check for cpuset prefix
Signed-off-by Shuang Qiu <[email protected]>
Quoted 13 lines
--- .../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
PATCH 1/1 controllers/cpuset:check for cpuset mount status and prefix
Quoted 9 lines · Jan Stancek
----- Original Message -----
Quoted 5 lines
From: "shuang qiu" <[email protected]>
To: [email protected]
Sent: Thursday, 14 July, 2016 8:54:00 AM
Subject: [LTP] [PATCH] controllers/cpuset:check for cpuset mount status and prefix
Quoted 5 lines
Quoted 3 lines
From: Shuang Qiu <[email protected]>
* 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.
Quoted 18 lines
Quoted 5 lines
* Similar with commit 6ce94db5bbff0be40813f3fdfe61a55b3186c49a,need to check for cpuset prefix
Signed-off-by Shuang Qiu <[email protected]>Quoted 13 lines
--- .../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(-)
Quoted 8 lines
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
Quoted 3 lines
Thanks,
Jan
PATCH 1/1 controllers/cpuset:check for cpuset mount status and prefix
In reply to Jan StancekQuoted 9 lines · Jan Stancek
----- Original Message -----
Quoted 5 lines
From: "shuang qiu" <[email protected]>
To: [email protected]
Sent: Thursday, 14 July, 2016 8:54:00 AM
Subject: [LTP] [PATCH] controllers/cpuset:check for cpuset mount status and prefix
Quoted 6 lines
Quoted 3 lines
From: Shuang Qiu <[email protected]>
* 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 ?
Quoted 28 lines
Quoted 4 lines
* Similar with commit 6ce94db5bbff0be40813f3fdfe61a55b3186c49a,need to check for cpuset prefix
Signed-off-by Shuang Qiu <[email protected]>Quoted 13 lines
--- .../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
PATCH 1/1 controllers/cpuset:check for cpuset mount status and prefix
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
* 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
PATCH 1/1 controllers/cpuset:check for cpuset mount status and prefix
Hi!
Quoted 1 line
any objections to the patch?
I looked at the patchset and pointed out some minor issues. Looks good to me if these are fixed.
Quoted 3 lines
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.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 1/1 controllers/cpuset:check for cpuset mount status and prefix
In reply to [email protected]Hi!
testcases/kernel/controllers/cpuset/cpuset_funcs.sh fi · line 38
Quoted 10 lines
testcases/kernel/controllers/cpuset/cpuset_funcs.sh +1
-1@@ -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)
testcases/kernel/controllers/cpuset/cpuset_funcs.sh fi · line 41
Quoted 3 lines
testcases/kernel/controllers/cpuset/cpuset_funcs.sh +2
-0+[ "$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)?
Quoted 15 lines
testcases/kernel/controllers/cpuset/cpuset_funcs.sh +1
-7HOTPLUG_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"
testcases/kernel/controllers/cpuset/cpuset_funcs.sh check() · line 133
Quoted 10 lines
testcases/kernel/controllers/cpuset/cpuset_funcs.sh +6
-4- 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
testcases/kernel/controllers/cpuset/cpuset_funcs.sh check() · line 142
Quoted 8 lines
testcases/kernel/controllers/cpuset/cpuset_funcs.sh +7
-0+ 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.
Quoted 7 lines
testcases/kernel/controllers/cpuset/cpuset_funcs.sh +0
-0fi }@@ -162,13 +168,14 @@ cleanup() fi done
testcases/kernel/controllers/cpuset/cpuset_funcs.sh cleanup() · line 179
Quoted 10 lines
testcases/kernel/controllers/cpuset/cpuset_funcs.sh +2
-1+ 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.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 1/1 controllers/cpuset:check for cpuset mount status and prefix
Hi Cyril,
Thank you for review.
I agree all your comment and will update the patch.
Thanks
Shuang
Quoted 87 lines · Cyril Hrubis
Hi!
testcases/kernel/controllers/cpuset/cpuset_funcs.sh fi · line 38
Quoted 10 lines
testcases/kernel/controllers/cpuset/cpuset_funcs.sh +1
-1@@ -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)testcases/kernel/controllers/cpuset/cpuset_funcs.sh fi · line 41
Quoted 3 lines
testcases/kernel/controllers/cpuset/cpuset_funcs.sh +2
-0+[ "$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)?
Quoted 15 lines
testcases/kernel/controllers/cpuset/cpuset_funcs.sh +1
-7HOTPLUG_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"testcases/kernel/controllers/cpuset/cpuset_funcs.sh check() · line 133
Quoted 10 lines
testcases/kernel/controllers/cpuset/cpuset_funcs.sh +6
-4- 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" + fiThe 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 ... fitestcases/kernel/controllers/cpuset/cpuset_funcs.sh check() · line 142
Quoted 8 lines
testcases/kernel/controllers/cpuset/cpuset_funcs.sh +7
-0+ 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" + fiWe should set the
try_mountafter the mount here since otherwise we will try to umount it in the cleanup if the mount here has failed.Also it
try_mountis not a good name for the flag. It should be rather called moutned instead.Quoted 7 lines
testcases/kernel/controllers/cpuset/cpuset_funcs.sh +0
-0fi }@@ -162,13 +168,14 @@ cleanup() fi donetestcases/kernel/controllers/cpuset/cpuset_funcs.sh cleanup() · line 179
Quoted 10 lines
testcases/kernel/controllers/cpuset/cpuset_funcs.sh +2
-1+ 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.