Skip to contentSkip to conversation

blkcg: delete redundant get/put operations for queue

PATCH RESEND Applied Chunguang Xu 2 participants 2 messages Jan 25, 2021 – Jan 26, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 blkcg: delete redundant get/put operations for queue

From: Chunguang Xu <[email protected]>

When calling blkcg_schedule_throttle(), for the same queue, redundant get/put operations can be removed.

---
 block/blk-cgroup.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
block/blk-cgroup.c +8 -5
index 031114d..e9b264b 100644
@@ -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);
Signature · 1 line
1.8.3.1
maintainer Applied
#1 lore raw
Quoted 4 lines · Chunguang Xu

From: Chunguang Xu <[email protected]>

When calling blkcg_schedule_throttle(), for the same queue, redundant get/put operations can be removed.

Applied, thanks.

Signature · 1 line
Jens Axboe