Skip to content

Commit f22ecf9

Browse files
poluoaxboe
authored andcommitted
blk-mq: delete task running check in blk_hctx_poll()
blk_hctx_poll() always checks if the task is running or not, and returns 1 if the task is running. This is a leftover from when polled IO was purely for synchronous IO, and doesn't make sense anymore when polled IO is purely asynchronous. Similarly, marking the task as TASK_RUNNING is also superflous, as the very much has to be running to enter the function in the first place. It looks like there has been this judgment for historical reasons, and in very early versions of this function the user would set the process state to TASK_UNINTERRUPTIBLE. Signed-off-by: Diangang Li <lidiangang@bytedance.com> Signed-off-by: Fengnan Chang <changfengnan@bytedance.com> [axboe: kill all remnants of task running, pointless now. massage message] Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 2c38ec9 commit f22ecf9

1 file changed

Lines changed: 2 additions & 10 deletions

File tree

block/blk-mq.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5192,27 +5192,19 @@ EXPORT_SYMBOL_GPL(blk_mq_update_nr_hw_queues);
51925192
static int blk_hctx_poll(struct request_queue *q, struct blk_mq_hw_ctx *hctx,
51935193
struct io_comp_batch *iob, unsigned int flags)
51945194
{
5195-
long state = get_current_state();
51965195
int ret;
51975196

51985197
do {
51995198
ret = q->mq_ops->poll(hctx, iob);
5200-
if (ret > 0) {
5201-
__set_current_state(TASK_RUNNING);
5199+
if (ret > 0)
52025200
return ret;
5203-
}
5204-
5205-
if (signal_pending_state(state, current))
5206-
__set_current_state(TASK_RUNNING);
5207-
if (task_is_running(current))
5201+
if (task_sigpending(current))
52085202
return 1;
5209-
52105203
if (ret < 0 || (flags & BLK_POLL_ONESHOT))
52115204
break;
52125205
cpu_relax();
52135206
} while (!need_resched());
52145207

5215-
__set_current_state(TASK_RUNNING);
52165208
return 0;
52175209
}
52185210

0 commit comments

Comments
 (0)