]> git.baikalelectronics.ru Git - kernel.git/commitdiff
blk-cgroup: cleanup blk_cgroup_congested
authorChristoph Hellwig <hch@lst.de>
Wed, 20 Apr 2022 04:27:21 +0000 (06:27 +0200)
committerJens Axboe <axboe@kernel.dk>
Mon, 2 May 2022 20:06:20 +0000 (14:06 -0600)
Use blkcg_css instead of open coding it, and switch to a slightly
more natural for loop.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Tejun Heo <tj@kernel.org>
Link: https://lore.kernel.org/r/20220420042723.1010598-14-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-cgroup.c

index 8da00ddc1766ecb09aefe409c92e9abd79034a23..5684a8ce1f75523e50696918a435c74de6aa81d1 100644 (file)
@@ -2038,15 +2038,11 @@ bool blk_cgroup_congested(void)
        bool ret = false;
 
        rcu_read_lock();
-       css = kthread_blkcg();
-       if (!css)
-               css = task_css(current, io_cgrp_id);
-       while (css) {
+       for (css = blkcg_css(); css; css = css->parent) {
                if (atomic_read(&css->cgroup->congestion_count)) {
                        ret = true;
                        break;
                }
-               css = css->parent;
        }
        rcu_read_unlock();
        return ret;