linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] blk-rq-qos: remove redundant finish_wait to rq_qos_wait.
@ 2020-06-24 13:04 Guo Xuenan
  2020-06-24 15:06 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Guo Xuenan @ 2020-06-24 13:04 UTC (permalink / raw)
  To: axboe, linux-block; +Cc: guoxuenan, fangwei1, wangli74

It is no need do finish_wait twice after acquiring inflight.

Signed-off-by: Guo Xuenan <guoxuenan@huawei.com>
---
 block/blk-rq-qos.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/block/blk-rq-qos.c b/block/blk-rq-qos.c
index 656460636ad3..00a08e53dc24 100644
--- a/block/blk-rq-qos.c
+++ b/block/blk-rq-qos.c
@@ -270,8 +270,10 @@ void rq_qos_wait(struct rq_wait *rqw, void *private_data,
 	has_sleeper = !wq_has_single_sleeper(&rqw->wait);
 	do {
 		/* The memory barrier in set_task_state saves us here. */
-		if (data.got_token)
-			break;
+		if (data.got_token) {
+			finish_wait(&rqw->wait, &data.wq);
+			return;
+		}
 		if (!has_sleeper && acquire_inflight_cb(rqw, private_data)) {
 			finish_wait(&rqw->wait, &data.wq);
 
@@ -289,7 +291,6 @@ void rq_qos_wait(struct rq_wait *rqw, void *private_data,
 		has_sleeper = true;
 		set_current_state(TASK_UNINTERRUPTIBLE);
 	} while (1);
-	finish_wait(&rqw->wait, &data.wq);
 }
 
 void rq_qos_exit(struct request_queue *q)
-- 
2.25.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] blk-rq-qos: remove redundant finish_wait to rq_qos_wait.
  2020-06-24 13:04 [PATCH] blk-rq-qos: remove redundant finish_wait to rq_qos_wait Guo Xuenan
@ 2020-06-24 15:06 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2020-06-24 15:06 UTC (permalink / raw)
  To: Guo Xuenan, linux-block; +Cc: fangwei1, wangli74

On 6/24/20 7:04 AM, Guo Xuenan wrote:
> It is no need do finish_wait twice after acquiring inflight.

Seems cleaner to kill the redundant one, rather than adding
a new one and removing another one. We end up with less
code that way.

diff --git a/block/blk-rq-qos.c b/block/blk-rq-qos.c
index 656460636ad3..18f3eab9f768 100644
--- a/block/blk-rq-qos.c
+++ b/block/blk-rq-qos.c
@@ -273,8 +273,6 @@ void rq_qos_wait(struct rq_wait *rqw, void *private_data,
 		if (data.got_token)
 			break;
 		if (!has_sleeper && acquire_inflight_cb(rqw, private_data)) {
-			finish_wait(&rqw->wait, &data.wq);
-
 			/*
 			 * We raced with wbt_wake_function() getting a token,
 			 * which means we now have two. Put our local token

-- 
Jens Axboe


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-06-24 15:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-24 13:04 [PATCH] blk-rq-qos: remove redundant finish_wait to rq_qos_wait Guo Xuenan
2020-06-24 15:06 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).