Move RT check into its own method, and save value.
This commit is contained in:
+15
-6
@@ -640,12 +640,8 @@ class CPULimitedHost( Host ):
|
||||
# still does better with larger period values.
|
||||
self.period_us = kwargs.get( 'period_us', 100000 )
|
||||
self.sched = sched
|
||||
if self.sched == 'rt':
|
||||
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 )
|
||||
if sched == 'rt':
|
||||
self.checkRtGroupSched()
|
||||
self.rtprio = 20
|
||||
|
||||
def cgroupSet( self, param, value, resource='cpu' ):
|
||||
@@ -710,6 +706,19 @@ class CPULimitedHost( Host ):
|
||||
quota = int( self.period_us * f )
|
||||
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):
|
||||
"Internal method: return parameters for CFS bandwidth"
|
||||
pstr, qstr = 'cfs_period_us', 'cfs_quota_us'
|
||||
|
||||
Reference in New Issue
Block a user