Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

controllers/cpuset_memory_spread: #831

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not use $CPUSET?

while read pid
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While should be indented.

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is cgdelete?

It is not a shell function or program I have installed.

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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there appears to be an extra indent. Maybe you are mixing tabs and spaces?

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`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this supposed to do and is it the simplest way to do it?

For example, could you do this by reading cgroup.procs or tasks in the root group or just using ps?

Also after we move all these processes, do they get moved back to where they came from?

Do we split the memory nodes between between group 1 and sys? I guess that one or more nodes need to be excluded from the test and assigned to sys. Assuming there are enough nodes available on the machine.

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the same thing be achieved by writing to /proc/sys/vm/stat_refresh?

Note that stat_refresh is not available on older kernels, in which case you can fall back to sleeping.

if [ $? -ne 0 ]; then
cpuset_log_error $CPUSET_TMP/stderr
tst_resm TFAIL "drop caches failed."
Expand Down