Skip to content

Commit ade1bee

Browse files
shroffniaxboe
authored andcommitted
block: decrement block_rq_qos static key in rq_qos_del()
rq_qos_add() increments the block_rq_qos static key when a QoS policy is attached. When a QoS policy is removed via rq_qos_del(), we must symmetrically decrement the static key. If this removal drops the last QoS policy from the queue (q->rq_qos becomes NULL), the static branch can be disabled and the jump label patched to a NOP, avoiding overhead on the hot path. This change ensures rq_qos_add()/rq_qos_del() keep the block_rq_qos static key balanced and prevents leaving the branch permanently enabled after the last policy is removed. Fixes: 033b667 ("block: blk-rq-qos: guard rq-qos helpers by static key") Signed-off-by: Nilay Shroff <[email protected]> Reviewed-by: Ming Lei <[email protected]> Reviewed-by: Yu Kuai <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 2753328 commit ade1bee

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

block/blk-rq-qos.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ void rq_qos_del(struct rq_qos *rqos)
374374
for (cur = &q->rq_qos; *cur; cur = &(*cur)->next) {
375375
if (*cur == rqos) {
376376
*cur = rqos->next;
377+
static_branch_dec(&block_rq_qos);
377378
break;
378379
}
379380
}

0 commit comments

Comments
 (0)