mirror of
https://github.com/ARM-software/devlib.git
synced 2025-02-07 05:30:44 +00:00
cgroups: Mount cgroups controllers in devlib working dir
Android seems to have a buggy `mount` command which causes `mount -o remount` to result in duplicated mounts. We can't unmonunt and then re-mount /sys/fs/cgroup because there may be pre-existing mounts at subdirectories. So we create a 'cgroups' directory in the devlib working directory and mount cgroup controller FS's there.
This commit is contained in:
parent
c89f712923
commit
2f35999f37
@ -300,7 +300,6 @@ class CgroupsModule(Module):
|
|||||||
|
|
||||||
name = 'cgroups'
|
name = 'cgroups'
|
||||||
stage = 'setup'
|
stage = 'setup'
|
||||||
cgroup_root = '/sys/fs/cgroup'
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def probe(target):
|
def probe(target):
|
||||||
@ -315,22 +314,6 @@ class CgroupsModule(Module):
|
|||||||
|
|
||||||
self.logger = logging.getLogger('CGroups')
|
self.logger = logging.getLogger('CGroups')
|
||||||
|
|
||||||
# Initialize controllers mount point
|
|
||||||
mounted = self.target.list_file_systems()
|
|
||||||
if self.cgroup_root not in [e.mount_point for e in mounted]:
|
|
||||||
self.target.execute('mount -t tmpfs {} {}'\
|
|
||||||
.format('cgroup_root',
|
|
||||||
self.cgroup_root),
|
|
||||||
as_root=True)
|
|
||||||
else:
|
|
||||||
self.logger.debug('cgroup_root already mounted at %s',
|
|
||||||
self.cgroup_root)
|
|
||||||
|
|
||||||
# Ensure CGroups is mounted RW
|
|
||||||
self.target.execute('mount -o remount,rw {}'\
|
|
||||||
.format(self.cgroup_root),
|
|
||||||
as_root=True)
|
|
||||||
|
|
||||||
# Load list of available controllers
|
# Load list of available controllers
|
||||||
controllers = []
|
controllers = []
|
||||||
subsys = self.list_subsystems()
|
subsys = self.list_subsystems()
|
||||||
@ -346,7 +329,9 @@ class CgroupsModule(Module):
|
|||||||
if not controller.probe(self.target):
|
if not controller.probe(self.target):
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
controller.mount(self.target, self.cgroup_root)
|
cgroup_root = target.path.join(target.working_directory,
|
||||||
|
'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))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user