Skip to content

Conversation

@blktests-ci
Copy link

@blktests-ci blktests-ci bot commented Jan 15, 2026

Pull request for series with
subject: nvme: optimize passthrough IOPOLL completion for local ring context
version: 1
url: https://patchwork.kernel.org/project/linux-block/list/?series=1042707

@blktests-ci
Copy link
Author

blktests-ci bot commented Jan 15, 2026

Upstream branch: 944aacb
series: https://patchwork.kernel.org/project/linux-block/list/?series=1042707
version: 1

@blktests-ci
Copy link
Author

blktests-ci bot commented Jan 16, 2026

Upstream branch: 944aacb
series: https://patchwork.kernel.org/project/linux-block/list/?series=1043177
version: 2

@blktests-ci blktests-ci bot added V2 and removed V1 V1-ci-pass labels Jan 16, 2026
@blktests-ci blktests-ci bot force-pushed the series/1042707=>linus-master branch from a17a32f to eb9f854 Compare January 16, 2026 07:49
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from 8a473ad to fa94b37 Compare January 19, 2026 00:27
@blktests-ci
Copy link
Author

blktests-ci bot commented Jan 19, 2026

Upstream branch: 944aacb
series: https://patchwork.kernel.org/project/linux-block/list/?series=1043177
version: 2

@blktests-ci blktests-ci bot force-pushed the series/1042707=>linus-master branch from eb9f854 to 0986113 Compare January 19, 2026 00:29
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from fa94b37 to 41a5848 Compare January 21, 2026 04:18
@blktests-ci
Copy link
Author

blktests-ci bot commented Jan 21, 2026

Upstream branch: 6c79021
series: https://patchwork.kernel.org/project/linux-block/list/?series=1043177
version: 2

@blktests-ci blktests-ci bot force-pushed the series/1042707=>linus-master branch from 0986113 to ee7006d Compare January 21, 2026 04:20
@blktests-ci blktests-ci bot force-pushed the linus-master_base branch from 41a5848 to 30680e5 Compare January 22, 2026 10:04
Ming Lei added 2 commits January 22, 2026 19:06
Add a third parameter 'const struct io_comp_batch *' to the rq_end_io_fn
callback signature. This allows end_io handlers to access the completion
batch context when requests are completed via blk_mq_end_request_batch().

The io_comp_batch is passed from blk_mq_end_request_batch(), while NULL
is passed from __blk_mq_end_request() and blk_mq_put_rq_ref() which don't
have batch context.

This infrastructure change enables drivers to detect whether they're
being called from a batched completion path (like iopoll) and access
additional context stored in the io_comp_batch.

Update all rq_end_io_fn implementations:
- block/blk-mq.c: blk_end_sync_rq
- block/blk-flush.c: flush_end_io, mq_flush_data_end_io
- drivers/nvme/host/ioctl.c: nvme_uring_cmd_end_io
- drivers/nvme/host/core.c: nvme_keep_alive_end_io
- drivers/nvme/host/pci.c: abort_endio, nvme_del_queue_end, nvme_del_cq_end
- drivers/nvme/target/passthru.c: nvmet_passthru_req_done
- drivers/scsi/scsi_error.c: eh_lock_door_done
- drivers/scsi/sg.c: sg_rq_end_io
- drivers/scsi/st.c: st_scsi_execute_end
- drivers/target/target_core_pscsi.c: pscsi_req_done
- drivers/md/dm-rq.c: end_clone_request

Signed-off-by: Ming Lei <ming.lei@redhat.com>
When multiple io_uring rings poll on the same NVMe queue, one ring can
find completions belonging to another ring. The current code always
uses task_work to handle this, but this adds overhead for the common
single-ring case.

This patch passes the polling io_ring_ctx through io_comp_batch's new
poll_ctx field. In io_do_iopoll(), the polling ring's context is stored
in iob.poll_ctx before calling the iopoll callbacks.

In nvme_uring_cmd_end_io(), we now compare iob->poll_ctx with the
request's owning io_ring_ctx (via io_uring_cmd_ctx_handle()). If they
match (local context), we complete inline with io_uring_cmd_done32().
If they differ (remote context) or iob is NULL (non-iopoll path), we
use task_work as before.

This optimization eliminates task_work scheduling overhead for the
common case where a ring polls and finds its own completions.

~10% IOPS improvement is observed in the following benchmark:

fio/t/io_uring -b512 -d128 -c32 -s32 -p1 -F1 -O0 -P1 -u1 -n1 /dev/ng0n1

Signed-off-by: Ming Lei <ming.lei@redhat.com>
@blktests-ci
Copy link
Author

blktests-ci bot commented Jan 22, 2026

Upstream branch: a66191c
series: https://patchwork.kernel.org/project/linux-block/list/?series=1043177
version: 2

@blktests-ci blktests-ci bot force-pushed the series/1042707=>linus-master branch from ee7006d to f888cf2 Compare January 22, 2026 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant