mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
Javi Merino
c212ef2146
module/cgroups: Really move all tasks in Controller.move_all_tasks_to()
The docstring of Controller.move_all_tasks_to() says that the function moves all the tasks to the "dest" cgroup. However, it iterates over self._cgroups, which is a dictionary that is lazily populated when you call Controller.cgroup(). For example, this doesn't work: cpuset_cg = target.cgroups.controller("cpuset") cpuset_cg.move_all_tasks_to("top-app") Because you haven't populated self._cgroups yet. You need to manually populate the dictionary with something like: for group in cpuset_cg.list_all(): cpuset_cg.cgroup(group) before you can use move_all_tasks_to(). Iterate through self.list_all() instead of self._cgroups to really move all tasks to to the destination directory. Controller.move_tasks() has a try-except block to get the cgroups of the source and destination groups. Controller.cgroup() caches the groups in self._cgroups and populates it if it hasn't been already. Simplify move_tasks() and let it deal with source and dest cgroups that exist but the controller hasn't loaded yet.
devlib ====== ``devlib`` exposes an interface for interacting with and collecting measurements from a variety of devices (such as mobile phones, tablets and development boards) running a Linux-based operating system. Installation ------------ :: sudo -H pip install devlib Usage ----- Please refer to the "Overview" section of the `documentation <http://devlib.readthedocs.io/en/latest/>`_. License ------- This package is distributed under `Apache v2.0 License <http://www.apache.org/licenses/LICENSE-2.0>`_. Feedback, Contrubutions and Support ----------------------------------- - Please use the GitHub Issue Tracker associated with this repository for feedback. - ARM licensees may contact ARM directly via their partner managers. - We welcome code contributions via GitHub Pull requests. Please try to stick to the style in the rest of the code for your contributions.
Description
Languages
Python
96%
Shell
1.8%
C
1.4%
Java
0.5%
Dockerfile
0.3%