diff --git a/testcases/kernel/controllers/cpuset/cpuset_funcs.sh b/testcases/kernel/controllers/cpuset/cpuset_funcs.sh index f3ba1d5ca93..bcecc7fa92a 100755 --- a/testcases/kernel/controllers/cpuset/cpuset_funcs.sh +++ b/testcases/kernel/controllers/cpuset/cpuset_funcs.sh @@ -187,15 +187,23 @@ cleanup() find "$CPUSET" -type d | sort | sed -n '2,$p' | tac | while read subdir do + if [ "$subdir" != "/dev/cpuset/sys" ]; then while read pid - do - /bin/kill -9 $pid > /dev/null 2>&1 - if [ $? -ne 0 ]; then - tst_brkm TFAIL "Couldn't kill task - "\ - "$pid in the cpuset" - fi - done < "$subdir/tasks" - rmdir "$subdir" + do + /bin/kill -9 $pid > /dev/null 2>&1 + if [ $? -ne 0 ]; then + tst_brkm TFAIL "Couldn't kill task - "\ + "$pid in the cpuset 1" + fi + done < "$subdir/tasks" + fi + + if [ "$subdir" == "/dev/cpuset/sys" ]; then + cgdelete -r cpuset:sys + else + rmdir "$subdir" + fi + if [ $? -ne 0 ]; then tst_brkm TFAIL "Couldn't remove subdir - " "$subdir in the cpuset" 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 e2767ef0524..4861e7b0bc8 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 @@ -194,6 +194,7 @@ result_check() general_memory_spread_test() { local cpusetpath="$CPUSET/1" + local cpusetpathsys="$CPUSET/sys" local is_spread="$1" local cpu_list="$2" local node_list="$3" @@ -206,6 +207,12 @@ general_memory_spread_test() tst_resm TFAIL "set general group parameter failed." return 1 fi + cpuset_set "$cpusetpathsys" "$cpu_list" "$node_list" "0" 2> $CPUSET_TMP/stderr + if [ $? -ne 0 ]; then + cpuset_log_error $CPUSET_TMP/stderr + tst_resm TFAIL "set general group parameter failed for sys." + return 1 + fi /bin/echo "$is_spread" > "$cpusetpath/cpuset.memory_spread_page" 2> $CPUSET_TMP/stderr if [ $? -ne 0 ]; then @@ -214,6 +221,19 @@ general_memory_spread_test() return 1 fi + /bin/echo "$is_spread" > "$cpusetpathsys/cpuset.memory_spread_page" 2> $CPUSET_TMP/stderr + if [ $? -ne 0 ]; then + cpuset_log_error $CPUSET_TMP/stderr + tst_resm TFAIL "set spread value failed for sys." + return 1 + fi + + array=`ps -elf |grep -v "\["|awk '{print $4}'|xargs echo` + for element in ${array[@]} + do + /bin/echo $element > "$cpusetpathsys/tasks" 2> /dev/null #$CPUSET_TMP/stderr + done + /bin/echo "$test_pid" > "$cpusetpath/tasks" 2> $CPUSET_TMP/stderr if [ $? -ne 0 ]; then cpuset_log_error $CPUSET_TMP/stderr @@ -224,6 +244,7 @@ general_memory_spread_test() # we'd better drop the caches before we test page cache. sync /bin/echo 3 > /proc/sys/vm/drop_caches 2> $CPUSET_TMP/stderr + sleep 3 if [ $? -ne 0 ]; then cpuset_log_error $CPUSET_TMP/stderr tst_resm TFAIL "drop caches failed."