Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions testcases/kernel/controllers/cpuset/cpuset_funcs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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."
Expand Down