diff options
author | Matthew Heon <matthew.heon@gmail.com> | 2018-02-01 12:55:28 -0500 |
---|---|---|
committer | Matthew Heon <matthew.heon@gmail.com> | 2018-02-01 12:55:28 -0500 |
commit | ae89dc28d07e1c6142201c282a76d3f237821710 (patch) | |
tree | a729a757fec7c22c5df9f1f65c4cc27556005e7e /vendor/github.com/containerd/cgroups/cgroup.go | |
parent | 03cfe5ebbee306ee4aa84c74bbff83712e50fb1c (diff) | |
download | podman-ae89dc28d07e1c6142201c282a76d3f237821710.tar.gz podman-ae89dc28d07e1c6142201c282a76d3f237821710.tar.bz2 podman-ae89dc28d07e1c6142201c282a76d3f237821710.zip |
Update containerd/cgroups repo fix perf issue
Signed-off-by: Matthew Heon <matthew.heon@gmail.com>
Diffstat (limited to 'vendor/github.com/containerd/cgroups/cgroup.go')
-rw-r--r-- | vendor/github.com/containerd/cgroups/cgroup.go | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/vendor/github.com/containerd/cgroups/cgroup.go b/vendor/github.com/containerd/cgroups/cgroup.go index 74a324f9e..d1c36bde3 100644 --- a/vendor/github.com/containerd/cgroups/cgroup.go +++ b/vendor/github.com/containerd/cgroups/cgroup.go @@ -10,6 +10,7 @@ import ( "sync" specs "github.com/opencontainers/runtime-spec/specs-go" + "github.com/pkg/errors" ) // New returns a new control via the cgroup cgroups interface @@ -39,6 +40,9 @@ func Load(hierarchy Hierarchy, path Path) (Cgroup, error) { for _, s := range pathers(subsystems) { p, err := path(s.Name()) if err != nil { + if os.IsNotExist(errors.Cause(err)) { + return nil, ErrCgroupDeleted + } return nil, err } if _, err := os.Lstat(s.Path(p)); err != nil { @@ -154,8 +158,8 @@ func (c *cgroup) Delete() error { return nil } -// Stat returns the current stats for the cgroup -func (c *cgroup) Stat(handlers ...ErrorHandler) (*Stats, error) { +// Stat returns the current metrics for the cgroup +func (c *cgroup) Stat(handlers ...ErrorHandler) (*Metrics, error) { c.mu.Lock() defer c.mu.Unlock() if c.err != nil { @@ -165,9 +169,14 @@ func (c *cgroup) Stat(handlers ...ErrorHandler) (*Stats, error) { handlers = append(handlers, errPassthrough) } var ( - stats = &Stats{} - wg = &sync.WaitGroup{} - errs = make(chan error, len(c.subsystems)) + stats = &Metrics{ + CPU: &CPUStat{ + Throttling: &Throttle{}, + Usage: &CPUUsage{}, + }, + } + wg = &sync.WaitGroup{} + errs = make(chan error, len(c.subsystems)) ) for _, s := range c.subsystems { if ss, ok := s.(stater); ok { @@ -301,7 +310,8 @@ func (c *cgroup) Thaw() error { } // OOMEventFD returns the memory cgroup's out of memory event fd that triggers -// when processes inside the cgroup receive an oom event +// when processes inside the cgroup receive an oom event. Returns +// ErrMemoryNotSupported if memory cgroups is not supported. func (c *cgroup) OOMEventFD() (uintptr, error) { c.mu.Lock() defer c.mu.Unlock() |