mirror of
				https://github.com/ARM-software/devlib.git
				synced 2025-11-03 23:41:21 +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:
		@@ -300,7 +300,6 @@ class CgroupsModule(Module):
 | 
			
		||||
 | 
			
		||||
    name = 'cgroups'
 | 
			
		||||
    stage = 'setup'
 | 
			
		||||
    cgroup_root = '/sys/fs/cgroup'
 | 
			
		||||
 | 
			
		||||
    @staticmethod
 | 
			
		||||
    def probe(target):
 | 
			
		||||
@@ -315,22 +314,6 @@ class CgroupsModule(Module):
 | 
			
		||||
 | 
			
		||||
        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
 | 
			
		||||
        controllers = []
 | 
			
		||||
        subsys = self.list_subsystems()
 | 
			
		||||
@@ -346,7 +329,9 @@ class CgroupsModule(Module):
 | 
			
		||||
            if not controller.probe(self.target):
 | 
			
		||||
                continue
 | 
			
		||||
            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:
 | 
			
		||||
                message = 'cgroups {} controller is not supported by the target'
 | 
			
		||||
                raise TargetError(message.format(controller.kind))
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user