[19.03 backport] Switch swarmmode services to NanoCpu
| ... | ... |
@@ -6,7 +6,6 @@ import ( |
| 6 | 6 |
"net" |
| 7 | 7 |
"strconv" |
| 8 | 8 |
"strings" |
| 9 |
- "time" |
|
| 10 | 9 |
|
| 11 | 10 |
"github.com/sirupsen/logrus" |
| 12 | 11 |
|
| ... | ... |
@@ -31,10 +30,6 @@ import ( |
| 31 | 31 |
) |
| 32 | 32 |
|
| 33 | 33 |
const ( |
| 34 |
- // Explicitly use the kernel's default setting for CPU quota of 100ms. |
|
| 35 |
- // https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt |
|
| 36 |
- cpuQuotaPeriod = 100 * time.Millisecond |
|
| 37 |
- |
|
| 38 | 34 |
// systemLabelPrefix represents the reserved namespace for system labels. |
| 39 | 35 |
systemLabelPrefix = "com.docker.swarm" |
| 40 | 36 |
) |
| ... | ... |
@@ -451,9 +446,7 @@ func (c *containerConfig) resources() enginecontainer.Resources {
|
| 451 | 451 |
} |
| 452 | 452 |
|
| 453 | 453 |
if r.Limits.NanoCPUs > 0 {
|
| 454 |
- // CPU Period must be set in microseconds. |
|
| 455 |
- resources.CPUPeriod = int64(cpuQuotaPeriod / time.Microsecond) |
|
| 456 |
- resources.CPUQuota = r.Limits.NanoCPUs * resources.CPUPeriod / 1e9 |
|
| 454 |
+ resources.NanoCPUs = r.Limits.NanoCPUs |
|
| 457 | 455 |
} |
| 458 | 456 |
|
| 459 | 457 |
return resources |