mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
shutils/cgroups: fix run_into support
In the previous patch: cgroups: Mount cgroups controllers in devlib working dir we changed the default mount point for devlib managed CGroups but forgot to update the support for execution of a workload within a specified CGroup. The run_into support is provide by a shutil script, which still has hardcoded the old path (i.e. /sys/fs/cgroup/devlib_*). This patch fixes this by: - resetting the default path to the Linux standard /sys/fs/cgroup - use-sing the existing CGMOUNT env variable to specify which CGroups mount point to use The cgroups::run_into is also updated to use the self.cgroup_root via CGMOUNT when the shutils' script is called. Moreover, an additional cgroups::run_into_cmd method is added which just returns a properly formatted run_into shutils' call. Signed-off-by: Patrick Bellasi <patrick.bellasi@arm.com>
This commit is contained in:
parent
68f7585ac2
commit
b2ec957bf8
@ -102,7 +102,7 @@ cgroups_get_attributes() {
|
|||||||
cgroups_run_into() {
|
cgroups_run_into() {
|
||||||
|
|
||||||
# Control groups mount point
|
# Control groups mount point
|
||||||
CGMOUNT=${CGMOUNT:-/sys/fs/cgroup/devlib_*}
|
CGMOUNT=${CGMOUNT:-/sys/fs/cgroup}
|
||||||
# The control group we want to run into
|
# The control group we want to run into
|
||||||
CGP=${1}
|
CGP=${1}
|
||||||
shift 1
|
shift 1
|
||||||
|
@ -314,6 +314,10 @@ class CgroupsModule(Module):
|
|||||||
|
|
||||||
self.logger = logging.getLogger('CGroups')
|
self.logger = logging.getLogger('CGroups')
|
||||||
|
|
||||||
|
# Set Devlib's CGroups mount point
|
||||||
|
self.cgroup_root = target.path.join(
|
||||||
|
target.working_directory, 'cgroups')
|
||||||
|
|
||||||
# Load list of available controllers
|
# Load list of available controllers
|
||||||
controllers = []
|
controllers = []
|
||||||
subsys = self.list_subsystems()
|
subsys = self.list_subsystems()
|
||||||
@ -329,9 +333,7 @@ class CgroupsModule(Module):
|
|||||||
if not controller.probe(self.target):
|
if not controller.probe(self.target):
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
cgroup_root = target.path.join(target.working_directory,
|
controller.mount(self.target, self.cgroup_root)
|
||||||
'cgroups')
|
|
||||||
controller.mount(self.target, cgroup_root)
|
|
||||||
except TargetError:
|
except TargetError:
|
||||||
message = 'cgroups {} controller is not supported by the target'
|
message = 'cgroups {} controller is not supported by the target'
|
||||||
raise TargetError(message.format(controller.kind))
|
raise TargetError(message.format(controller.kind))
|
||||||
@ -359,12 +361,18 @@ class CgroupsModule(Module):
|
|||||||
return None
|
return None
|
||||||
return self.controllers[kind]
|
return self.controllers[kind]
|
||||||
|
|
||||||
|
def run_into_cmd(self, cgroup, cmdline):
|
||||||
|
return 'CGMOUNT={} {} cgroups_run_into {} {}'\
|
||||||
|
.format(self.cgroup_root, self.target.shutils,
|
||||||
|
cgroup, cmdline)
|
||||||
|
|
||||||
def run_into(self, cgroup, cmdline):
|
def run_into(self, cgroup, cmdline):
|
||||||
"""
|
"""
|
||||||
Run the specified command into the specified CGroup
|
Run the specified command into the specified CGroup
|
||||||
"""
|
"""
|
||||||
return self.target._execute_util(
|
return self.target._execute_util(
|
||||||
'cgroups_run_into {} {}'.format(cgroup, cmdline),
|
'CGMOUNT={} cgroups_run_into {} {}'\
|
||||||
|
.format(self.cgroup_root, cgroup, cmdline),
|
||||||
as_root=True)
|
as_root=True)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user