Skip to content

Commit

Permalink
blk-mq: improve warning for running a queue on the wrong CPU
Browse files Browse the repository at this point in the history
__blk_mq_run_hw_queue() currently warns if we are running the queue on a
CPU that isn't set in its mask. However, this can happen if a CPU is
being offlined, and the workqueue handling will place the work on CPU0
instead. Improve the warning so that it only triggers if the batch cpu
in the hardware queue is currently online.  If it triggers for that
case, then it's indicative of a flow problem in blk-mq, so we want to
retain it for that case.

Signed-off-by: Jens Axboe <axboe@fb.com>
  • Loading branch information
Jens Axboe committed Aug 24, 2016
1 parent e57690f commit 0e87e58
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions block/blk-mq.c
Original file line number Diff line number Diff line change
Expand Up @@ -793,11 +793,12 @@ static void __blk_mq_run_hw_queue(struct blk_mq_hw_ctx *hctx)
struct list_head *dptr;
int queued;

WARN_ON(!cpumask_test_cpu(raw_smp_processor_id(), hctx->cpumask));

if (unlikely(test_bit(BLK_MQ_S_STOPPED, &hctx->state)))
return;

WARN_ON(!cpumask_test_cpu(raw_smp_processor_id(), hctx->cpumask) &&
cpu_online(hctx->next_cpu));

hctx->run++;

/*
Expand Down

0 comments on commit 0e87e58

Please sign in to comment.