Re: [PATCH v2 6/6] scsi: bsg: release io_uring requests in end-I/O
From: Yingjie Wang
Date: Thu Oct 29 2026 - 12:43:22 EST
Hi Yang, Bart,
On Tue, Oct 27, 2026, Yang Xiuwei wrote:
> For reference: scsi_mq_init_request() already allocates sense_buffer
> from scsi_sense_cache. A second buffer from that cache, bsg_sense, can
> hold the copy.
Thanks for the suggestion. I tried allocating a second buffer from
scsi_sense_cache in end-I/O for CHECK CONDITION responses. With 16
commands in flight, all returning CHECK CONDITION, the variant added
4.5 to 5.2 us per command on a KASAN kernel compared with keeping the
request until task work. Without debug options, the difference was
within run-to-run noise.
For v3, I will leave out the additional allocation. End-I/O will free
requests that do not need a sense copy, as NVMe passthrough does. For
sense-bearing requests, task work will save the sense data on the stack
and free the request before user copyback. The tag will still be held
until that point.
Rejecting IORING_SETUP_DEFER_TASKRUN would not address faults during
ordinary task work either. The sense-length fix from v2 5/6 is folded
into v3 5/6.
I will also account for James Houghton's cancellation fix when rebasing,
since it touches the same callback.
I plan to send v3 after -rc1, once the prerequisites are in place.
Thanks,
Yingjie