diff options
author | Jens Axboe <axboe@kernel.dk> | 2018-08-20 15:20:50 -0400 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-08-22 17:07:31 -0400 |
commit | b78820937b4762b7d30b807d7156bec1d89e4dd3 (patch) | |
tree | a4500f662f1f18e496ae7660e6daca5307b82d3a | |
parent | ffa358dcaae1f2f00926484e712e06daa8953cb4 (diff) |
blk-wbt: use wq_has_sleeper() for wq active check
We need the memory barrier before checking the list head,
use the appropriate helper for this. The matching queue
side memory barrier is provided by set_current_state().
Tested-by: Anchal Agarwal <anchalag@amazon.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r-- | block/blk-wbt.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/block/blk-wbt.c b/block/blk-wbt.c index 1dd7edce7a99..853e22492f4e 100644 --- a/block/blk-wbt.c +++ b/block/blk-wbt.c | |||
@@ -118,7 +118,7 @@ static void rwb_wake_all(struct rq_wb *rwb) | |||
118 | for (i = 0; i < WBT_NUM_RWQ; i++) { | 118 | for (i = 0; i < WBT_NUM_RWQ; i++) { |
119 | struct rq_wait *rqw = &rwb->rq_wait[i]; | 119 | struct rq_wait *rqw = &rwb->rq_wait[i]; |
120 | 120 | ||
121 | if (waitqueue_active(&rqw->wait)) | 121 | if (wq_has_sleeper(&rqw->wait)) |
122 | wake_up_all(&rqw->wait); | 122 | wake_up_all(&rqw->wait); |
123 | } | 123 | } |
124 | } | 124 | } |
@@ -162,7 +162,7 @@ static void __wbt_done(struct rq_qos *rqos, enum wbt_flags wb_acct) | |||
162 | if (inflight && inflight >= limit) | 162 | if (inflight && inflight >= limit) |
163 | return; | 163 | return; |
164 | 164 | ||
165 | if (waitqueue_active(&rqw->wait)) { | 165 | if (wq_has_sleeper(&rqw->wait)) { |
166 | int diff = limit - inflight; | 166 | int diff = limit - inflight; |
167 | 167 | ||
168 | if (!inflight || diff >= rwb->wb_background / 2) | 168 | if (!inflight || diff >= rwb->wb_background / 2) |
@@ -493,8 +493,8 @@ static void __wbt_wait(struct rq_wb *rwb, enum wbt_flags wb_acct, | |||
493 | struct rq_wait *rqw = get_rq_wait(rwb, wb_acct); | 493 | struct rq_wait *rqw = get_rq_wait(rwb, wb_acct); |
494 | DECLARE_WAITQUEUE(wait, current); | 494 | DECLARE_WAITQUEUE(wait, current); |
495 | 495 | ||
496 | if (!waitqueue_active(&rqw->wait) | 496 | if (!wq_has_sleeper(&rqw->wait) && |
497 | && rq_wait_inc_below(rqw, get_limit(rwb, rw))) | 497 | rq_wait_inc_below(rqw, get_limit(rwb, rw))) |
498 | return; | 498 | return; |
499 | 499 | ||
500 | add_wait_queue_exclusive(&rqw->wait, &wait); | 500 | add_wait_queue_exclusive(&rqw->wait, &wait); |