Merge pull request #221 from thaJeztah/18.09_backport_swarmnanocpu
[18.09 backport] Switch swarmmode services to NanoCpu Upstream-commit: d1a30309de3f9e13d78779976e28ce52dfebdf2f Component: engine
This commit is contained in:
@ -6,7 +6,6 @@ import (
|
||||
"net"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
|
||||
@ -31,10 +30,6 @@ import (
|
||||
)
|
||||
|
||||
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 = "com.docker.swarm"
|
||||
)
|
||||
@ -448,9 +443,7 @@ func (c *containerConfig) resources() enginecontainer.Resources {
|
||||
}
|
||||
|
||||
if r.Limits.NanoCPUs > 0 {
|
||||
// CPU Period must be set in microseconds.
|
||||
resources.CPUPeriod = int64(cpuQuotaPeriod / time.Microsecond)
|
||||
resources.CPUQuota = r.Limits.NanoCPUs * resources.CPUPeriod / 1e9
|
||||
resources.NanoCPUs = r.Limits.NanoCPUs
|
||||
}
|
||||
|
||||
return resources
|
||||
|
||||
Reference in New Issue
Block a user