Skip to content

Commit

Permalink
blkcg: delete redundant get/put operations for queue
Browse files Browse the repository at this point in the history
When calling blkcg_schedule_throttle(), for the same queue,
redundant get/put operations can be removed.

Signed-off-by: Chunguang Xu <brookxu@tencent.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
brookxu-tx authored and axboe committed Jan 26, 2021
1 parent 2c2b9fd commit 49d1822
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions block/blk-cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -1757,12 +1757,15 @@ void blkcg_schedule_throttle(struct request_queue *q, bool use_memdelay)
if (unlikely(current->flags & PF_KTHREAD))
return;

if (!blk_get_queue(q))
return;
if (current->throttle_queue != q) {
if (!blk_get_queue(q))
return;

if (current->throttle_queue)
blk_put_queue(current->throttle_queue);
current->throttle_queue = q;
}

if (current->throttle_queue)
blk_put_queue(current->throttle_queue);
current->throttle_queue = q;
if (use_memdelay)
current->use_memdelay = use_memdelay;
set_notify_resume(current);
Expand Down

0 comments on commit 49d1822

Please sign in to comment.