Skip to content

Commit 103cc23

Browse files
committed
Fix pids cgroup
Signed-off-by: Tonis Tiigi <[email protected]>
1 parent 0505d60 commit 103cc23

8 files changed

Lines changed: 180 additions & 204 deletions

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ RUN set -x \
260260

261261

262262
# Install containerd
263-
ENV CONTAINERD_COMMIT docker-containerd-integration-2
263+
ENV CONTAINERD_COMMIT pidsstats
264264
RUN set -x \
265265
&& export GOPATH="$(mktemp -d)" \
266266
&& git clone git://github.com/tonistiigi/containerd.git "$GOPATH/src/github.com/docker/containerd" \

api/client/stats_helpers.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ func (s *containerStats) Collect(cli client.APIClient, streamStats bool, waitFir
116116
s.NetworkRx, s.NetworkTx = calculateNetwork(v.Networks)
117117
s.BlockRead = float64(blkRead)
118118
s.BlockWrite = float64(blkWrite)
119+
s.PidsCurrent = v.PidsStats.Current
119120
s.mu.Unlock()
120121
u <- nil
121122
if !streamStats {
@@ -137,6 +138,7 @@ func (s *containerStats) Collect(cli client.APIClient, streamStats bool, waitFir
137138
s.NetworkTx = 0
138139
s.BlockRead = 0
139140
s.BlockWrite = 0
141+
s.PidsCurrent = 0
140142
s.mu.Unlock()
141143
// if this is the first stat you get, release WaitGroup
142144
if !getFirst {

daemon/daemon_unix.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1119,8 +1119,12 @@ func (daemon *Daemon) stats(c *container.Container) (*types.StatsJSON, error) {
11191119
Stats: cgs.MemoryStats.Stats,
11201120
Failcnt: mem.Failcnt,
11211121
}
1122+
if cgs.PidsStats != nil {
1123+
s.PidsStats = types.PidsStats{
1124+
Current: cgs.PidsStats.Current,
1125+
}
1126+
}
11221127
}
11231128
s.Read = time.Unix(int64(stats.Timestamp), 0)
1124-
11251129
return s, nil
11261130
}

daemon/oci_linux.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ func setResources(s *specs.LinuxSpec, r containertypes.Resources) error {
6262
ThrottleWriteIOPSDevice: writeIOpsDevice,
6363
},
6464
DisableOOMKiller: r.OomKillDisable,
65+
Pids: &specs.Pids{
66+
Limit: &r.PidsLimit,
67+
},
6568
}
6669

6770
if s.Linux.Resources != nil && len(s.Linux.Resources.Devices) > 0 {

daemon/stats_linux.go

Lines changed: 0 additions & 84 deletions
This file was deleted.

hack/vendor.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ clone git google.golang.org/api dc6d2353af16e2a2b0ff6986af051d473a4ed468 https:/
9090
clone git google.golang.org/cloud dae7e3d993bc3812a2185af60552bb6b847e52a0 https://code.googlesource.com/gocloud
9191

9292
# containerd
93-
clone git github.com/docker/containerd 21ec6309792b955cfb301c983c5da5305b881899
93+
#clone git github.com/docker/containerd 21ec6309792b955cfb301c983c5da5305b881899
94+
clone git github.com/docker/containerd pidsstats https://github.com/tonistiigi/containerd.git
9495

9596
clean

0 commit comments

Comments
 (0)