提交 aa61bec3 编写于 作者: J Jens Axboe

blk-mq: ensure mq_ops ->poll() is entered at least once

Right now we immediately bail if need_resched() is true, but
we need to do at least one loop in case we have entries waiting.
So just invert the need_resched() check, putting it at the
bottom of the loop.
Reviewed-by: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NJens Axboe <axboe@kernel.dk>
上级 0a1b8b87
......@@ -3375,7 +3375,7 @@ static int blk_mq_poll(struct request_queue *q, blk_qc_t cookie, bool spin)
hctx->poll_considered++;
state = current->state;
while (!need_resched()) {
do {
int ret;
hctx->poll_invoked++;
......@@ -3395,7 +3395,7 @@ static int blk_mq_poll(struct request_queue *q, blk_qc_t cookie, bool spin)
if (ret < 0 || !spin)
break;
cpu_relax();
}
} while (!need_resched());
__set_current_state(TASK_RUNNING);
return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册