Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Fengnan Chang and committed by
Jens Axboe
f22ecf9c 2c38ec93

+2 -10
+2 -10
block/blk-mq.c
··· 5192 5192 static int blk_hctx_poll(struct request_queue *q, struct blk_mq_hw_ctx *hctx, 5193 5193 struct io_comp_batch *iob, unsigned int flags) 5194 5194 { 5195 - long state = get_current_state(); 5196 5195 int ret; 5197 5196 5198 5197 do { 5199 5198 ret = q->mq_ops->poll(hctx, iob); 5200 - if (ret > 0) { 5201 - __set_current_state(TASK_RUNNING); 5199 + if (ret > 0) 5202 5200 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)) 5208 5202 return 1; 5209 - 5210 5203 if (ret < 0 || (flags & BLK_POLL_ONESHOT)) 5211 5204 break; 5212 5205 cpu_relax(); 5213 5206 } while (!need_resched()); 5214 5207 5215 - __set_current_state(TASK_RUNNING); 5216 5208 return 0; 5217 5209 } 5218 5210