On Fri, Mar 21, 2025 at 1:37 PM Pavel Begunkov <asml.silence@xxxxxxxxx> wrote: > > On 3/21/25 18:48, Caleb Sander Mateos wrote: > > io_send_zc() guards its call to io_send_zc_import() with if (!done_io) > > in an attempt to avoid calling it redundantly on the same req. However, > > if the initial non-blocking issue returns -EAGAIN, done_io will stay 0. > > This causes the subsequent issue to unnecessarily re-import the buffer. > > > > Add an explicit flag "imported" to io_sr_msg to track if its buffer has > > already been imported. Clear the flag in io_send_zc_prep(). Call > > io_send_zc_import() and set the flag in io_send_zc() if it is unset. > > lgtm. Maybe there is a way to put it into req->flags and combine > with REQ_F_IMPORT_BUFFER, but likely just an idea for the future. Yes, I considered making it a bitflag. But since there was an existing hole in io_sr_msg, I figured it wasn't worth optimizing. Certainly if we want to shrink io_sr_msg in the future, this is low-hanging fruit. I'm a bit hesitant to reserve a bit in the generic req->flags that's only used for one opcode. Best, Caleb