blk-mq: bound blk_hctx_poll() to one jiffy#954
Conversation
|
Upstream branch: 9716c08 |
c3a084b to
5f78e5d
Compare
|
Upstream branch: 2a2974b |
3257ec1 to
af806da
Compare
5f78e5d to
e48f9db
Compare
|
Upstream branch: 062871f |
af806da to
e93707b
Compare
199644a to
e6d9eb8
Compare
|
Upstream branch: 66affa3 |
e93707b to
0914e0c
Compare
|
Upstream branch: 66affa3 |
0914e0c to
49d7889
Compare
e6d9eb8 to
7d8604f
Compare
|
Upstream branch: bade58e |
49d7889 to
5cdff14
Compare
7d8604f to
4cc45a3
Compare
|
Upstream branch: 4edcdef |
5cdff14 to
58cb0b5
Compare
4cc45a3 to
90ffd56
Compare
|
Upstream branch: dc59e4f |
58cb0b5 to
7efa8b9
Compare
90ffd56 to
d52f35a
Compare
|
Upstream branch: 87320be |
7efa8b9 to
c6e8142
Compare
d52f35a to
a644c13
Compare
blk_hctx_poll() can busy-poll until a completion is found or need_resched() becomes true. On preemptible kernels, the scheduler can set TIF_NEED_RESCHED on the timer tick and preempt the task at IRQ return before the loop condition re-evaluates it. After the context switch, the flag is cleared, so the poller can continue spinning instead of returning to its caller. This can happen with io_uring IOPOLL reads inside iocb_bio_iopoll(), which holds the rcu_read_lock() while calling bio_poll(). If another poller on the same polled queue drains the available completions, this poller may repeatedly find no completions and remain inside the RCU read-side critical section long enough to trigger RCU stall reports: rcu: INFO: rcu_preempt detected stalls on CPUs/tasks: rcu: Tasks blocked on level-1 rcu_node (CPUs 0-9): P3961 rcu: (detected by 3, t=60002 jiffies, g=18533, q=4943 ncpus=20) task:fio state:R running task stack:0 pid:3961 Call Trace: <TASK> ? nvme_poll+0x36/0xa0 [nvme] ? blk_hctx_poll+0x39/0x90 ? blk_mq_poll+0x30/0x60 ? bio_poll+0x87/0x170 ? iocb_bio_iopoll+0x32/0x50 ? io_uring_classic_poll+0x25/0x50 ? io_do_iopoll+0x216/0x420 ? __do_sys_io_uring_enter+0x2c7/0x7c0 Reproducible with: fio -filename=/dev/nvme0n1 -direct=1 -size=4g -rw=randread \ --numjobs=32 -bs=4K -ioengine=io_uring -hipri=1 -iodepth=1 \ --registerfiles=1 --group_reporting --thread Record the starting jiffy and exit the loop once jiffies has advanced. This bounds each blk_hctx_poll() invocation while also covering the case where the reschedule flag was cleared by the context switch before the loop condition could observe it. Fixes: f22ecf9 ("blk-mq: delete task running check in blk_hctx_poll()") Reviewed-by: Fengnan Chang <changfengnan@bytedance.com> Suggested-by: Fengnan Chang <changfengnan@bytedance.com> Signed-off-by: Anuj Gupta <anuj20.g@samsung.com> Signed-off-by: Alok Rathore <alok.rathore@samsung.com>
|
Upstream branch: 8cdeaa5 |
c6e8142 to
afecf91
Compare
a644c13 to
a2204c3
Compare
Pull request for series with
subject: blk-mq: bound blk_hctx_poll() to one jiffy
version: 1
url: https://patchwork.kernel.org/project/linux-block/list/?series=1110191