mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #39190 from ollypom/swarmnanocpu
Switch Swarm Mode services to NanoCpu
This commit is contained in:
commit
03a03c6c32
1 changed files with 1 additions and 8 deletions
|
@ -6,7 +6,6 @@ import (
|
||||||
"net"
|
"net"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
|
||||||
|
@ -31,10 +30,6 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Explicitly use the kernel's default setting for CPU quota of 100ms.
|
|
||||||
// https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt
|
|
||||||
cpuQuotaPeriod = 100 * time.Millisecond
|
|
||||||
|
|
||||||
// systemLabelPrefix represents the reserved namespace for system labels.
|
// systemLabelPrefix represents the reserved namespace for system labels.
|
||||||
systemLabelPrefix = "com.docker.swarm"
|
systemLabelPrefix = "com.docker.swarm"
|
||||||
)
|
)
|
||||||
|
@ -451,9 +446,7 @@ func (c *containerConfig) resources() enginecontainer.Resources {
|
||||||
}
|
}
|
||||||
|
|
||||||
if r.Limits.NanoCPUs > 0 {
|
if r.Limits.NanoCPUs > 0 {
|
||||||
// CPU Period must be set in microseconds.
|
resources.NanoCPUs = r.Limits.NanoCPUs
|
||||||
resources.CPUPeriod = int64(cpuQuotaPeriod / time.Microsecond)
|
|
||||||
resources.CPUQuota = r.Limits.NanoCPUs * resources.CPUPeriod / 1e9
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return resources
|
return resources
|
||||||
|
|
Loading…
Add table
Reference in a new issue