1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

Merge pull request #39733 from olljanat/win-restore-no-parallelism

Windows: do not use parallelism on container restart
This commit is contained in:
Sebastiaan van Stijn 2019-11-12 09:43:31 -08:00 committed by GitHub
commit c83188248e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,7 +3,9 @@ package daemon // import "github.com/docker/docker/daemon"
import (
"context"
"fmt"
"math"
"path/filepath"
"runtime"
"strings"
"github.com/Microsoft/hcsshim"
@ -41,9 +43,10 @@ const (
windowsMaxCPUPercent = 100
)
// Windows doesn't really have rlimits.
// Windows containers are much larger than Linux containers and each of them
// have > 20 system processes which why we use much smaller parallelism value.
func adjustParallelLimit(n int, limit int) int {
return limit
return int(math.Max(1, math.Floor(float64(runtime.NumCPU())*.8)))
}
// Windows has no concept of an execution state directory. So use config.Root here.