diff options
author | Chunguang Xu <brookxu@tencent.com> | 2021-01-25 13:05:28 +0800 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2021-01-26 13:14:30 -0700 |
commit | 49d1822bc05e702be1665ffc2092ec5711e77491 (patch) | |
tree | 7eac30c97fadabfa253974bdba1609706a19f36d /block | |
parent | 2c2b9fd6b496b3616e9b9537ea0258b3040914f3 (diff) |
blkcg: delete redundant get/put operations for queue
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>
Diffstat (limited to 'block')
-rw-r--r-- | block/blk-cgroup.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 3465d6ee708e..02ce2058c14b 100644 --- a/block/blk-cgroup.c +++ b/block/blk-cgroup.c @@ -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); |