Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
a5a70b4d
Unverified
Commit
a5a70b4d
authored
May 01, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
May 01, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #74859 from ahadas/static_policy
kubelet/cm: code optimization for the static policy
parents
02306646
4a47148a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
cpu_assignment.go
pkg/kubelet/cm/cpumanager/cpu_assignment.go
+10
-4
cpu_assignment_test.go
pkg/kubelet/cm/cpumanager/cpu_assignment_test.go
+1
-1
No files found.
pkg/kubelet/cm/cpumanager/cpu_assignment.go
View file @
a5a70b4d
...
...
@@ -158,25 +158,31 @@ func takeByTopology(topo *topology.CPUTopology, availableCPUs cpuset.CPUSet, num
// Algorithm: topology-aware best-fit
// 1. Acquire whole sockets, if available and the container requires at
// least a socket's-worth of CPUs.
for
_
,
s
:=
range
acc
.
freeSockets
(
)
{
if
acc
.
needs
(
acc
.
topo
.
CPUsPerSocket
()
)
{
if
acc
.
needs
(
acc
.
topo
.
CPUsPerSocket
()
)
{
for
_
,
s
:=
range
acc
.
freeSockets
(
)
{
klog
.
V
(
4
)
.
Infof
(
"[cpumanager] takeByTopology: claiming socket [%d]"
,
s
)
acc
.
take
(
acc
.
details
.
CPUsInSocket
(
s
))
if
acc
.
isSatisfied
()
{
return
acc
.
result
,
nil
}
if
!
acc
.
needs
(
acc
.
topo
.
CPUsPerSocket
())
{
break
}
}
}
// 2. Acquire whole cores, if available and the container requires at least
// a core's-worth of CPUs.
for
_
,
c
:=
range
acc
.
freeCores
(
)
{
if
acc
.
needs
(
acc
.
topo
.
CPUsPerCore
()
)
{
if
acc
.
needs
(
acc
.
topo
.
CPUsPerCore
()
)
{
for
_
,
c
:=
range
acc
.
freeCores
(
)
{
klog
.
V
(
4
)
.
Infof
(
"[cpumanager] takeByTopology: claiming core [%d]"
,
c
)
acc
.
take
(
acc
.
details
.
CPUsInCore
(
c
))
if
acc
.
isSatisfied
()
{
return
acc
.
result
,
nil
}
if
!
acc
.
needs
(
acc
.
topo
.
CPUsPerCore
())
{
break
}
}
}
...
...
pkg/kubelet/cm/cpumanager/cpu_assignment_test.go
View file @
a5a70b4d
...
...
@@ -356,7 +356,7 @@ func TestTakeByTopology(t *testing.T) {
cpuset
.
NewCPUSet
(
2
,
6
),
},
{
"take
three cpus
from dual socket with HT - core from Socket 0"
,
"take
one cpu
from dual socket with HT - core from Socket 0"
,
topoDualSocketHT
,
cpuset
.
NewCPUSet
(
1
,
2
,
3
,
4
,
5
,
7
,
8
,
9
,
10
,
11
),
1
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment