Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mininet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Olaf Bergmann
mininet
Commits
820c3be7
Commit
820c3be7
authored
10 years ago
by
Bob Lantz
Browse files
Options
Downloads
Patches
Plain Diff
Reorganize CFS and RT default/error conditions.
parent
a562ca1b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mininet/node.py
+24
-23
24 additions, 23 deletions
mininet/node.py
with
24 additions
and
23 deletions
mininet/node.py
+
24
−
23
View file @
820c3be7
...
@@ -689,6 +689,19 @@ def cleanup( self ):
...
@@ -689,6 +689,19 @@ def cleanup( self ):
super
(
CPULimitedHost
,
self
).
cleanup
()
super
(
CPULimitedHost
,
self
).
cleanup
()
retry
(
retries
=
3
,
delaySecs
=
1
,
fn
=
self
.
cgroupDel
)
retry
(
retries
=
3
,
delaySecs
=
1
,
fn
=
self
.
cgroupDel
)
_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
chrt
(
self
):
def
chrt
(
self
):
"
Set RT scheduling priority
"
"
Set RT scheduling priority
"
quietRun
(
'
chrt -p %s %s
'
%
(
self
.
rtprio
,
self
.
pid
)
)
quietRun
(
'
chrt -p %s %s
'
%
(
self
.
rtprio
,
self
.
pid
)
)
...
@@ -706,20 +719,7 @@ def rtInfo( self, f ):
...
@@ -706,20 +719,7 @@ def rtInfo( self, f ):
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?
def
cfsInfo
(
self
,
f
):
@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
"
"
Internal method: return parameters for CFS bandwidth
"
pstr
,
qstr
=
'
cfs_period_us
'
,
'
cfs_quota_us
'
pstr
,
qstr
=
'
cfs_period_us
'
,
'
cfs_quota_us
'
# CFS uses wall clock time for period and CPU time for quota.
# CFS uses wall clock time for period and CPU time for quota.
...
@@ -729,6 +729,9 @@ def cfsInfo( self, f):
...
@@ -729,6 +729,9 @@ def cfsInfo( self, f):
debug
(
'
(cfsInfo: increasing default period)
'
)
debug
(
'
(cfsInfo: increasing default period)
'
)
quota
=
1000
quota
=
1000
period
=
int
(
quota
/
f
/
numCores
()
)
period
=
int
(
quota
/
f
/
numCores
()
)
# Reset to unlimited on negative quota
if
quota
<
0
:
quota
=
-
1
return
pstr
,
qstr
,
period
,
quota
return
pstr
,
qstr
,
period
,
quota
# BL comment:
# BL comment:
...
@@ -740,25 +743,23 @@ def cfsInfo( self, f):
...
@@ -740,25 +743,23 @@ def cfsInfo( self, f):
# to CPU seconds per second, essentially assuming that
# to CPU seconds per second, essentially assuming that
# all CPUs are the same.
# all CPUs are the same.
def
setCPUFrac
(
self
,
f
=-
1
,
sched
=
None
):
def
setCPUFrac
(
self
,
f
,
sched
=
None
):
"""
Set overall CPU fraction for this host
"""
Set overall CPU fraction for this host
f: CPU bandwidth limit (
fraction
)
f: CPU bandwidth limit (
positive fraction, or -1 for cfs unlimited
)
sched:
'
rt
'
or
'
cfs
'
sched:
'
rt
'
or
'
cfs
'
Note
'
cfs
'
requires CONFIG_CFS_BANDWIDTH
"""
Note
'
cfs
'
requires CONFIG_CFS_BANDWIDTH,
# if cpu fraction is None, reset to default of 0
and
'
rt
'
requires CONFIG_RT_GROUP_SCHED
"""
if
not
f
:
f
=
-
1
if
not
sched
:
if
not
sched
:
sched
=
self
.
sched
sched
=
self
.
sched
if
sched
==
'
rt
'
:
if
sched
==
'
rt
'
:
if
not
f
or
f
<
0
:
raise
Exception
(
'
Please set a positive CPU fraction for sched=rt
\n
'
)
return
pstr
,
qstr
,
period
,
quota
=
self
.
rtInfo
(
f
)
pstr
,
qstr
,
period
,
quota
=
self
.
rtInfo
(
f
)
elif
sched
==
'
cfs
'
:
elif
sched
==
'
cfs
'
:
pstr
,
qstr
,
period
,
quota
=
self
.
cfsInfo
(
f
)
pstr
,
qstr
,
period
,
quota
=
self
.
cfsInfo
(
f
)
else
:
else
:
return
return
if
quota
<
0
:
# Reset to unlimited
quota
=
-
1
# Set cgroup's period and quota
# Set cgroup's period and quota
setPeriod
=
self
.
cgroupSet
(
pstr
,
period
)
setPeriod
=
self
.
cgroupSet
(
pstr
,
period
)
setQuota
=
self
.
cgroupSet
(
qstr
,
quota
)
setQuota
=
self
.
cgroupSet
(
qstr
,
quota
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment