summaryrefslogtreecommitdiff
path: root/block/blk-wbt.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2018-08-20 13:20:50 -0600
committerJens Axboe <axboe@kernel.dk>2018-08-22 15:07:31 -0600
commitb78820937b4762b7d30b807d7156bec1d89e4dd3 (patch)
treea4500f662f1f18e496ae7660e6daca5307b82d3a /block/blk-wbt.c
parentffa358dcaae1f2f00926484e712e06daa8953cb4 (diff)
downloadlwn-b78820937b4762b7d30b807d7156bec1d89e4dd3.tar.gz
lwn-b78820937b4762b7d30b807d7156bec1d89e4dd3.zip
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>
Diffstat (limited to 'block/blk-wbt.c')
-rw-r--r--block/blk-wbt.c8
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)
for (i = 0; i < WBT_NUM_RWQ; i++) {
struct rq_wait *rqw = &rwb->rq_wait[i];
- if (waitqueue_active(&rqw->wait))
+ if (wq_has_sleeper(&rqw->wait))
wake_up_all(&rqw->wait);
}
}
@@ -162,7 +162,7 @@ static void __wbt_done(struct rq_qos *rqos, enum wbt_flags wb_acct)
if (inflight && inflight >= limit)
return;
- if (waitqueue_active(&rqw->wait)) {
+ if (wq_has_sleeper(&rqw->wait)) {
int diff = limit - inflight;
if (!inflight || diff >= rwb->wb_background / 2)
@@ -493,8 +493,8 @@ static void __wbt_wait(struct rq_wb *rwb, enum wbt_flags wb_acct,
struct rq_wait *rqw = get_rq_wait(rwb, wb_acct);
DECLARE_WAITQUEUE(wait, current);
- if (!waitqueue_active(&rqw->wait)
- && rq_wait_inc_below(rqw, get_limit(rwb, rw)))
+ if (!wq_has_sleeper(&rqw->wait) &&
+ rq_wait_inc_below(rqw, get_limit(rwb, rw)))
return;
add_wait_queue_exclusive(&rqw->wait, &wait);