Move RT check into its own method, and save value.
This commit is contained in:
+16
-7
@@ -640,13 +640,9 @@ class CPULimitedHost( Host ):
|
|||||||
# still does better with larger period values.
|
# still does better with larger period values.
|
||||||
self.period_us = kwargs.get( 'period_us', 100000 )
|
self.period_us = kwargs.get( 'period_us', 100000 )
|
||||||
self.sched = sched
|
self.sched = sched
|
||||||
if self.sched == 'rt':
|
if sched == 'rt':
|
||||||
release = quietRun( 'uname -r' ).strip('\r\n')
|
self.checkRtGroupSched()
|
||||||
output = quietRun( 'grep CONFIG_RT_GROUP_SCHED /boot/config-%s' % release )
|
self.rtprio = 20
|
||||||
if output == '# CONFIG_RT_GROUP_SCHED is not set\n':
|
|
||||||
error( '\n*** error: please enable RT_GROUP_SCHED in your kernel\n' )
|
|
||||||
exit( 1 )
|
|
||||||
self.rtprio = 20
|
|
||||||
|
|
||||||
def cgroupSet( self, param, value, resource='cpu' ):
|
def cgroupSet( self, param, value, resource='cpu' ):
|
||||||
"Set a cgroup parameter and return its value"
|
"Set a cgroup parameter and return its value"
|
||||||
@@ -710,6 +706,19 @@ class CPULimitedHost( Host ):
|
|||||||
quota = int( self.period_us * f )
|
quota = int( self.period_us * f )
|
||||||
return pstr, qstr, self.period_us, quota
|
return pstr, qstr, self.period_us, quota
|
||||||
|
|
||||||
|
_rtGroupSched = False # internal class var: Is CONFIG_RT_GROUP_SCHED set?
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def checkRtGroupSched( cls ):
|
||||||
|
"Check (Ubuntu,Debian) kernel config for CONFIG_RT_GROUP_SCHED for RT"
|
||||||
|
if not cls._rtGroupSched:
|
||||||
|
release = quietRun( 'uname -r' ).strip('\r\n')
|
||||||
|
output = quietRun( 'grep CONFIG_RT_GROUP_SCHED /boot/config-%s' % release )
|
||||||
|
if output == '# CONFIG_RT_GROUP_SCHED is not set\n':
|
||||||
|
error( '\n*** error: please enable RT_GROUP_SCHED in your kernel\n' )
|
||||||
|
exit( 1 )
|
||||||
|
cls._rtGroupSched = True
|
||||||
|
|
||||||
def cfsInfo( self, f):
|
def cfsInfo( self, f):
|
||||||
"Internal method: return parameters for CFS bandwidth"
|
"Internal method: return parameters for CFS bandwidth"
|
||||||
pstr, qstr = 'cfs_period_us', 'cfs_quota_us'
|
pstr, qstr = 'cfs_period_us', 'cfs_quota_us'
|
||||||
|
|||||||
Reference in New Issue
Block a user