linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH]blk-mq-sched: remove the empty entry in token wait list
@ 2017-08-29 14:52 查斌
  2017-09-07 18:40 ` Omar Sandoval
  0 siblings, 1 reply; 2+ messages in thread
From: 查斌 @ 2017-08-29 14:52 UTC (permalink / raw)
  To: linux-block; +Cc: osandov, axboe, boyu.mt, wenqing.lz, qijiang.qj

From:  Bin Zha <zhabin.zb@alibaba-inc.com>


When the kyber adjusts the sync and other write depth to the
minimum(1), there is a case that maybe cause the requests to
be stalled in the kyber_hctx_data list.

The following example I have tested:


CPU7
block_rq_insert
add_wait_queue
__sbitmap_queue_get              CPU23
block_rq_issue                   block_rq_insert
block_rq_complete ------>  waiting token free
                                          block_rq_issue
          /|\                            block_rq_complete
           |                                        |
           |                                        |
           |                                       \|/
           |                                     CPU29
           |                            block_rq_insert
           |                           waiting token free
           |                             block_rq_issue
           |---------------------- block_rq_complete

                                                CPU1
                                       block_rq_insert
                                      waiting token free


The IO request complete in CPU29 will wake up CPU7,
because it has been added to the waitqueue in
kyber_get_domain_token. But it is empty waiter, and won't
wake up the CPU1.If no other requests issue to push it,
the requests will stall in kyber_hctx_data list.


Signed-off-by: Bin Zha <zhabin.zb@alibaba-inc.com>

diff --git a/block/kyber-iosched.c b/block/kyber-iosched.c
index b9faabc..584bfd5 100644
--- a/block/kyber-iosched.c
+++ b/block/kyber-iosched.c
@@ -548,6 +548,10 @@ static int kyber_get_domain_token(struct
kyber_queue_data *kqd,
                 * queue.
                 */
                nr = __sbitmap_queue_get(domain_tokens);
+               if (nr >= 0) {
+                       remove_wait_queue(&ws->wait, wait);
+                       INIT_LIST_HEAD(&wait->task_list);
+               }
        }
        return nr;
 }

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

end of thread, other threads:[~2017-09-07 18:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-29 14:52 [PATCH]blk-mq-sched: remove the empty entry in token wait list 查斌
2017-09-07 18:40 ` Omar Sandoval

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).