io_uring/uring_cmd: use cached cmd_op in io_uring_cmd_sock()
Jens Axboe
maintainerPATCH 1/1 io_uring/uring_cmd: use cached cmd_op in io_uring_cmd_sock()
io_uring_cmd_sock() does a read of cmd->sqe->cmd_op, which may look like it's the userspace shared SQE, but it's a copy at this point. Use cmd->cmd_op rather than dip into the allocated SQE copy - it's both simpler and faster and leaves less room for confusion.
---
io_uring/uring_cmd.c +1 -1
@@ -350,7 +350,7 @@ int io_uring_cmd_sock(struct io_uring_cmd *cmd, unsigned int issue_flags)if (!prot || !prot->ioctl)return -EOPNOTSUPP ; -switch (cmd->sqe->cmd_op) { +switch (cmd->cmd_op) {case SOCKET_URING_OP_SIOCINQ : ret = prot->ioctl (sk,SIOCINQ , &arg);if (ret)
Signature · 1 line
Jens Axboe
Quoted 15 lines · Jens Axboe
io_uring_cmd_sock()does a read ofcmd->sqe->cmd_op, which may look like it's the userspace shared SQE, but it's a copy at this point. Usecmd->cmd_oprather than dip into the allocated SQE copy - it's both simpler and faster and leaves less room for confusion.Signed-off-by Jens Axboe <[email protected]>---
io_uring/uring_cmd.c +0
-0
io_uring/uring_cmd.c int io_uring_cmd_sock(struct io_uring_cmd *cmd, unsigned int issue_flags) · line 353
Quoted 5 lines
io_uring/uring_cmd.c +1
-1@@ -350,7 +350,7 @@ int io_uring_cmd_sock(struct io_uring_cmd *cmd, unsigned int issue_flags)if (!prot || !prot->ioctl)return -EOPNOTSUPP ; -switch (cmd->sqe->cmd_op) { +switch (cmd->cmd_op) {
Ah, yeah, this does look better than the READ_ONCE() I suggested.