mirror of
https://github.com/ARM-software/devlib.git
synced 2025-09-19 10:21:55 +01:00
module/cgroups: robustify task freezer
The set() method of the CGroup class used to freeze tasks relies on target's write_value(). Sometimes, the freezing procedure takes some time and the call to write_value() in set() fails by reading "FREEZING" while it expected "FROZEN". To avoid this issue, this commits introduces a shutil call dedicated to changing the state of the freezer controller.
This commit is contained in:
@@ -177,6 +177,23 @@ cgroups_tasks_in() {
|
||||
exit 0
|
||||
}
|
||||
|
||||
cgroups_freezer_set_state() {
|
||||
STATE=${1}
|
||||
SYSFS_ENTRY=${2}/freezer.state
|
||||
|
||||
# Set the state of the freezer
|
||||
echo $STATE > $SYSFS_ENTRY
|
||||
|
||||
# And check it applied cleanly
|
||||
for i in `seq 1 10`; do
|
||||
[ $($CAT $SYSFS_ENTRY) = $STATE ] && exit 0
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# We have an issue
|
||||
echo "ERROR: Freezer stalled while changing state to \"$STATE\"." >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
################################################################################
|
||||
# Main Function Dispatcher
|
||||
@@ -213,6 +230,9 @@ cgroups_tasks_move)
|
||||
cgroups_tasks_in)
|
||||
cgroups_tasks_in $*
|
||||
;;
|
||||
cgroups_freezer_set_state)
|
||||
cgroups_freezer_set_state $*
|
||||
;;
|
||||
ftrace_get_function_stats)
|
||||
ftrace_get_function_stats
|
||||
;;
|
||||
|
Reference in New Issue
Block a user