mirror of
https://github.com/containerd/containerd.git
synced 2026-08-09 09:33:06 +00:00
Vendor containerd/cgroups 9f1c62dddf4bc7cc72822ebe353bae7006141b1b
Backport cgroups fix: https://github.com/containerd/cgroups/pull/147 Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
github.com/beorn7/perks 4c0e84591b9aa9e6dcfdf3e020114cd81f89d5f9
|
||||
github.com/BurntSushi/toml v0.3.1
|
||||
github.com/containerd/btrfs af5082808c833de0e79c1e72eea9fea239364877
|
||||
github.com/containerd/cgroups c4b9ac5c7601384c965b9646fc515884e091ebb9
|
||||
github.com/containerd/cgroups 9f1c62dddf4bc7cc72822ebe353bae7006141b1b
|
||||
github.com/containerd/console v1.0.0
|
||||
github.com/containerd/continuity f2a389ac0a02ce21c09edd7344677a601970f41c
|
||||
github.com/containerd/fifo bda0ff6ed73c67bfb5e62bc9c697f146b7fd7f13
|
||||
|
||||
58
vendor/github.com/containerd/cgroups/blkio.go
generated
vendored
58
vendor/github.com/containerd/cgroups/blkio.go
generated
vendored
@@ -74,54 +74,47 @@ func (b *blkioController) Update(path string, resources *specs.LinuxResources) e
|
||||
|
||||
func (b *blkioController) Stat(path string, stats *Metrics) error {
|
||||
stats.Blkio = &BlkIOStat{}
|
||||
settings := []blkioStatSettings{
|
||||
{
|
||||
name: "throttle.io_serviced",
|
||||
entry: &stats.Blkio.IoServicedRecursive,
|
||||
},
|
||||
{
|
||||
name: "throttle.io_service_bytes",
|
||||
entry: &stats.Blkio.IoServiceBytesRecursive,
|
||||
},
|
||||
}
|
||||
|
||||
var settings []blkioStatSettings
|
||||
|
||||
// Try to read CFQ stats available on all CFQ enabled kernels first
|
||||
if _, err := os.Lstat(filepath.Join(b.Path(path), fmt.Sprintf("blkio.io_serviced_recursive"))); err == nil {
|
||||
settings = []blkioStatSettings{}
|
||||
settings = append(settings,
|
||||
blkioStatSettings{
|
||||
settings = []blkioStatSettings{
|
||||
{
|
||||
name: "sectors_recursive",
|
||||
entry: &stats.Blkio.SectorsRecursive,
|
||||
},
|
||||
blkioStatSettings{
|
||||
{
|
||||
name: "io_service_bytes_recursive",
|
||||
entry: &stats.Blkio.IoServiceBytesRecursive,
|
||||
},
|
||||
blkioStatSettings{
|
||||
{
|
||||
name: "io_serviced_recursive",
|
||||
entry: &stats.Blkio.IoServicedRecursive,
|
||||
},
|
||||
blkioStatSettings{
|
||||
{
|
||||
name: "io_queued_recursive",
|
||||
entry: &stats.Blkio.IoQueuedRecursive,
|
||||
},
|
||||
blkioStatSettings{
|
||||
{
|
||||
name: "io_service_time_recursive",
|
||||
entry: &stats.Blkio.IoServiceTimeRecursive,
|
||||
},
|
||||
blkioStatSettings{
|
||||
{
|
||||
name: "io_wait_time_recursive",
|
||||
entry: &stats.Blkio.IoWaitTimeRecursive,
|
||||
},
|
||||
blkioStatSettings{
|
||||
{
|
||||
name: "io_merged_recursive",
|
||||
entry: &stats.Blkio.IoMergedRecursive,
|
||||
},
|
||||
blkioStatSettings{
|
||||
{
|
||||
name: "time_recursive",
|
||||
entry: &stats.Blkio.IoTimeRecursive,
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
f, err := os.Open("/proc/diskstats")
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -133,6 +126,29 @@ func (b *blkioController) Stat(path string, stats *Metrics) error {
|
||||
return err
|
||||
}
|
||||
|
||||
var size int
|
||||
for _, t := range settings {
|
||||
if err := b.readEntry(devices, path, t.name, t.entry); err != nil {
|
||||
return err
|
||||
}
|
||||
size += len(*t.entry)
|
||||
}
|
||||
if size > 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Even the kernel is compiled with the CFQ scheduler, the cgroup may not use
|
||||
// block devices with the CFQ scheduler. If so, we should fallback to throttle.* files.
|
||||
settings = []blkioStatSettings{
|
||||
{
|
||||
name: "throttle.io_serviced",
|
||||
entry: &stats.Blkio.IoServicedRecursive,
|
||||
},
|
||||
{
|
||||
name: "throttle.io_service_bytes",
|
||||
entry: &stats.Blkio.IoServiceBytesRecursive,
|
||||
},
|
||||
}
|
||||
for _, t := range settings {
|
||||
if err := b.readEntry(devices, path, t.name, t.entry); err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user