iocost_monitor: fix kernel queue kobj changes
authorChengming Zhou <zhouchengming@bytedance.com>
Fri, 4 Aug 2023 06:50:37 +0000 (14:50 +0800)
committerJens Axboe <axboe@kernel.dk>
Tue, 8 Aug 2023 21:43:03 +0000 (15:43 -0600)
When I use iocost_monitor on nvme0n1, this error shows up:
"Could not find ioc for nvme0n1"

There is no kobj in struct queue in recent kernel, it seems that the commit
2bd85221a625 ("block: untangle request_queue refcounting from sysfs")
move the queue kobj to struct gendisk.

Fix it by using mq_kobj which is at the same level with queue kobj.

Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
Link: https://lore.kernel.org/r/20230804065039.8885-1-chengming.zhou@linux.dev
Signed-off-by: Jens Axboe <axboe@kernel.dk>
tools/cgroup/iocost_monitor.py

index 0dbbc67400fcb2612abe6a994f900f037301cc9b..7aa076cb559e0caab43410b9f87bbf328fef6d56 100644 (file)
@@ -221,7 +221,7 @@ ioc = None
 for i, ptr in radix_tree_for_each(blkcg_root.blkg_tree.address_of_()):
     blkg = drgn.Object(prog, 'struct blkcg_gq', address=ptr)
     try:
-        if devname == blkg.q.kobj.parent.name.string_().decode('utf-8'):
+        if devname == blkg.q.mq_kobj.parent.name.string_().decode('utf-8'):
             q_id = blkg.q.id.value_()
             if blkg.pd[plid]:
                 root_iocg = container_of(blkg.pd[plid], 'struct ioc_gq', 'pd')