mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
commit
6eabf7fc56
@ -9,6 +9,7 @@ GREP=${GREP:-$BUSYBOX grep}
|
||||
SED=${SED:-$BUSYBOX sed}
|
||||
CAT=${CAT:-$BUSYBOX cat}
|
||||
AWK=${AWK:-$BUSYBOX awk}
|
||||
PS=${PS:-$BUSYBOX ps}
|
||||
|
||||
################################################################################
|
||||
# CPUFrequency Utility Functions
|
||||
@ -156,11 +157,11 @@ cgroups_tasks_move() {
|
||||
|
||||
[ "x$FILTERS" = "x" ] && exit 0
|
||||
|
||||
PIDS=`ps | $GREP $FILTERS | $AWK '{print $2}'`
|
||||
PIDS=`$PS -o comm,pid | $GREP $FILTERS | $AWK '{print $2}'`
|
||||
PIDS=`echo $PIDS`
|
||||
echo "PIDs to save: [$PIDS]"
|
||||
for TID in $PIDS; do
|
||||
COMM =`$CAT /proc/$TID/comm`
|
||||
COMM=`$CAT /proc/$TID/comm`
|
||||
echo "$TID : $COMM"
|
||||
echo $TID > $SRC_GRP/cgroup.procs
|
||||
done
|
||||
|
@ -155,7 +155,7 @@ class Controller(object):
|
||||
# Build list of tasks to exclude
|
||||
grep_filters = ''
|
||||
for comm in exclude:
|
||||
grep_filters += '-e "{}" '.format(comm)
|
||||
grep_filters += '-e {} '.format(comm)
|
||||
logging.debug(' using grep filter: %s', grep_filters)
|
||||
if grep_filters != '':
|
||||
logging.debug(' excluding tasks which name matches:')
|
||||
@ -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))
|
||||
@ -448,6 +433,8 @@ class CgroupsModule(Module):
|
||||
|
||||
# Create Freezer CGroup
|
||||
freezer = self.controller('freezer')
|
||||
if freezer is None:
|
||||
raise RuntimeError('freezer cgroup controller not present')
|
||||
freezer_cg = freezer.cgroup('/DEVLIB_FREEZER')
|
||||
thawed_cg = freezer.cgroup('/')
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user