2021-08-23 13:14:53 +00:00
|
|
|
//go:build !linux && !freebsd && !windows
|
2017-11-01 23:37:53 +00:00
|
|
|
// +build !linux,!freebsd,!windows
|
2015-08-07 16:33:29 +00:00
|
|
|
|
2018-02-05 21:05:59 +00:00
|
|
|
package daemon // import "github.com/docker/docker/daemon"
|
2020-03-10 12:09:25 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/docker/docker/daemon/config"
|
|
|
|
"github.com/docker/docker/pkg/sysinfo"
|
|
|
|
)
|
2015-08-07 16:33:29 +00:00
|
|
|
|
|
|
|
const platformSupported = false
|
2018-07-17 19:11:38 +00:00
|
|
|
|
|
|
|
func setupResolvConf(config *config.Config) {
|
|
|
|
}
|
2020-03-10 12:09:25 +00:00
|
|
|
|
daemon: load and cache sysInfo on initialization
The `daemon.RawSysInfo()` function can be a heavy operation, as it collects
information about all cgroups on the host, networking, AppArmor, Seccomp, etc.
While looking at our code, I noticed that various parts in the code call this
function, potentially even _multiple times_ per container, for example, it is
called from:
- `verifyPlatformContainerSettings()`
- `oci.WithCgroups()` if the daemon has `cpu-rt-period` or `cpu-rt-runtime` configured
- in `ContainerDecoder.DecodeConfig()`, which is called on boith `container create` and `container commit`
Given that this information is not expected to change during the daemon's
lifecycle, and various information coming from this (such as seccomp and
apparmor status) was already cached, we may as well load it once, and cache
the results in the daemon instance.
This patch updates `daemon.RawSysInfo()` to use a `sync.Once()` so that
it's only executed once for the daemon's lifecycle.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-01-07 11:54:47 +00:00
|
|
|
func (daemon *Daemon) loadSysInfo() {
|
|
|
|
daemon.sysInfo = sysinfo.New()
|
2020-03-10 12:09:25 +00:00
|
|
|
}
|