From 9eb93c62629d7d0eb42c941d6368455749171258 Mon Sep 17 00:00:00 2001 From: zhangsong Date: Wed, 9 Oct 2019 07:24:50 +0800 Subject: [PATCH] lxcfs: proc_diskstats_read func obtain data from 'blkio.throttle.*' reason:There are many scheduler in linux kernel, such as cfq, bfq, deadline, etc. However, 'blkio.[a-z_]+' is for cfq, there is nothing provided when OS uses other scheduler. Cgroup block controller throttle works at generic block layer which could collect serviced and serviced_bytes information for every scheduler. Signed-off-by: zhangsong --- bindings.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bindings.c b/bindings.c index e7138f8..a76483c 100644 --- a/bindings.c +++ b/bindings.c @@ -4222,11 +4222,13 @@ static int proc_diskstats_read(char *buf, size_t size, off_t offset, return read_file("/proc/diskstats", buf, size, d); prune_init_slice(cg); - if (!(io_serviced_str = cgfs_get_value("blkio", cg, "blkio.io_serviced_recursive"))) + if (!(io_serviced_str = cgfs_get_value("blkio", cg, "blkio.throttle.io_serviced_recursive")) + && !(io_serviced_str = cgfs_get_value("blkio", cg, "blkio.throttle.io_serviced"))) goto err; if (!(io_merged_str = cgfs_get_value("blkio", cg, "blkio.io_merged_recursive"))) goto err; - if (!(io_service_bytes_str = cgfs_get_value("blkio", cg, "blkio.io_service_bytes_recursive"))) + if (!(io_service_bytes_str = cgfs_get_value("blkio", cg, "blkio.throttle.io_service_bytes_recursive")) + && !(io_service_bytes_str = cgfs_get_value("blkio", cg, "blkio.throttle.io_service_bytes"))) goto err; if (!(io_wait_time_str = cgfs_get_value("blkio", cg, "blkio.io_wait_time_recursive"))) goto err; -- 2.21.0