On 04/06/2017 12:10 PM, Bart Van Assche wrote: > + for (i = 0; i < queue->nr_hw_queues; i++) { > + j = (i + hctx->queue_num + 1) % queue->nr_hw_queues; > + h = queue->queue_hw_ctx[j]; > + if (h->tags == tags && blk_mq_sched_restart_hctx(h)) > + break; I'm pretty sure that doing: j = i + hctx->queue_num + 1;; for (i = 0; i < queue->nr_hw_queues; i++, j++) { if (j == queue->nr_hw_queues) j = 0; h = queue->queue_hw_ctx[j]; if (h->tags == tags && blk_mq_sched_restart_hctx(h)) break; } would be considerably more efficient than a modulo for each loop. And let's rename 'h' to 'hctx', readability is much better that way. Especially since you have both i and j as iterators. -- Jens Axboe