1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-09-07 20:41: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:
Quentin Perret
2017-08-21 18:16:10 +01:00
parent 66a50a2f49
commit 4b36439de8
2 changed files with 23 additions and 3 deletions

View File

@@ -466,11 +466,11 @@ class CgroupsModule(Module):
if freezer is None:
raise RuntimeError('freezer cgroup controller not present')
freezer_cg = freezer.cgroup('/DEVLIB_FREEZER')
thawed_cg = freezer.cgroup('/')
cmd = 'cgroups_freezer_set_state {{}} {}'.format(freezer_cg.directory)
if thaw:
# Restart froozen tasks
freezer_cg.set(state='THAWED')
freezer.target._execute_util(cmd.format('THAWED'), as_root=True)
# Remove all tasks from freezer
freezer.move_all_tasks_to('/')
return
@@ -482,7 +482,7 @@ class CgroupsModule(Module):
tasks = freezer.tasks('/')
# Freeze all tasks
freezer_cg.set(state='FROZEN')
freezer.target._execute_util(cmd.format('FROZEN'), as_root=True)
return tasks