Skip to content

Commit

Permalink
blk-cgroup: cleanup blk_cgroup_congested
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Christoph Hellwig authored and Jens Axboe committed May 2, 2022
1 parent bc5fee9 commit d200ca1
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions block/blk-cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d200ca1

Please sign in to comment.