Skip to content

Commit b788209

Browse files
committed
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 <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent ffa358d commit b788209

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

block/blk-wbt.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ static void rwb_wake_all(struct rq_wb *rwb)
118118
for (i = 0; i < WBT_NUM_RWQ; i++) {
119119
struct rq_wait *rqw = &rwb->rq_wait[i];
120120

121-
if (waitqueue_active(&rqw->wait))
121+
if (wq_has_sleeper(&rqw->wait))
122122
wake_up_all(&rqw->wait);
123123
}
124124
}
@@ -162,7 +162,7 @@ static void __wbt_done(struct rq_qos *rqos, enum wbt_flags wb_acct)
162162
if (inflight && inflight >= limit)
163163
return;
164164

165-
if (waitqueue_active(&rqw->wait)) {
165+
if (wq_has_sleeper(&rqw->wait)) {
166166
int diff = limit - inflight;
167167

168168
if (!inflight || diff >= rwb->wb_background / 2)
@@ -493,8 +493,8 @@ static void __wbt_wait(struct rq_wb *rwb, enum wbt_flags wb_acct,
493493
struct rq_wait *rqw = get_rq_wait(rwb, wb_acct);
494494
DECLARE_WAITQUEUE(wait, current);
495495

496-
if (!waitqueue_active(&rqw->wait)
497-
&& rq_wait_inc_below(rqw, get_limit(rwb, rw)))
496+
if (!wq_has_sleeper(&rqw->wait) &&
497+
rq_wait_inc_below(rqw, get_limit(rwb, rw)))
498498
return;
499499

500500
add_wait_queue_exclusive(&rqw->wait, &wait);

0 commit comments

Comments
 (0)