|
@@ -4,10 +4,12 @@ package daemon
|
|
|
|
|
|
import (
|
|
import (
|
|
"fmt"
|
|
"fmt"
|
|
|
|
+ "io/ioutil"
|
|
"net"
|
|
"net"
|
|
"os"
|
|
"os"
|
|
"path/filepath"
|
|
"path/filepath"
|
|
"runtime"
|
|
"runtime"
|
|
|
|
+ "runtime/debug"
|
|
"strconv"
|
|
"strconv"
|
|
"strings"
|
|
"strings"
|
|
"syscall"
|
|
"syscall"
|
|
@@ -462,6 +464,23 @@ func checkSystem() error {
|
|
return checkKernel()
|
|
return checkKernel()
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// configureMaxThreads sets the Go runtime max threads threshold
|
|
|
|
+// which is 90% of the kernel setting from /proc/sys/kernel/threads-max
|
|
|
|
+func configureMaxThreads(config *Config) error {
|
|
|
|
+ mt, err := ioutil.ReadFile("/proc/sys/kernel/threads-max")
|
|
|
|
+ if err != nil {
|
|
|
|
+ return err
|
|
|
|
+ }
|
|
|
|
+ mtint, err := strconv.Atoi(strings.TrimSpace(string(mt)))
|
|
|
|
+ if err != nil {
|
|
|
|
+ return err
|
|
|
|
+ }
|
|
|
|
+ maxThreads := (mtint / 100) * 90
|
|
|
|
+ debug.SetMaxThreads(maxThreads)
|
|
|
|
+ logrus.Debugf("Golang's threads limit set to %d", maxThreads)
|
|
|
|
+ return nil
|
|
|
|
+}
|
|
|
|
+
|
|
// configureKernelSecuritySupport configures and validate security support for the kernel
|
|
// configureKernelSecuritySupport configures and validate security support for the kernel
|
|
func configureKernelSecuritySupport(config *Config, driverName string) error {
|
|
func configureKernelSecuritySupport(config *Config, driverName string) error {
|
|
if config.EnableSelinuxSupport {
|
|
if config.EnableSelinuxSupport {
|