From: Chunguang Xu Date: Mon, 25 Jan 2021 05:05:28 +0000 (+0800) Subject: blkcg: delete redundant get/put operations for queue X-Git-Tag: v5.15~1584^2~61 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=49d1822bc05e702be1665ffc2092ec5711e77491;p=platform%2Fkernel%2Flinux-starfive.git 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 Acked-by: Tejun Heo Signed-off-by: Jens Axboe --- diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c index 3465d6e..02ce205 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);