[PATCH v4 0/3] io_uring/uring_cmd: avoid double indirect call in task work dispatch

Caleb Sander Mateos posted 3 patches 3 months, 1 week ago
block/ioctl.c                  |  6 ++++--
drivers/block/ublk_drv.c       | 18 ++++++++++--------
drivers/nvme/host/ioctl.c      |  7 ++++---
fs/btrfs/ioctl.c               |  5 +++--
fs/fuse/dev_uring.c            |  7 ++++---
include/linux/io_uring/cmd.h   | 22 +++++++++++++---------
include/linux/io_uring_types.h |  7 +++++--
io_uring/futex.c               | 16 +++++++++-------
io_uring/io_uring.c            | 26 ++++++++++++++------------
io_uring/io_uring.h            |  4 ++--
io_uring/msg_ring.c            |  3 ++-
io_uring/notif.c               |  5 +++--
io_uring/poll.c                | 11 ++++++-----
io_uring/poll.h                |  2 +-
io_uring/rw.c                  |  5 +++--
io_uring/rw.h                  |  2 +-
io_uring/timeout.c             | 18 +++++++++++-------
io_uring/uring_cmd.c           | 17 ++---------------
io_uring/waitid.c              |  7 ++++---
19 files changed, 101 insertions(+), 87 deletions(-)
[PATCH v4 0/3] io_uring/uring_cmd: avoid double indirect call in task work dispatch
Posted by Caleb Sander Mateos 3 months, 1 week ago
Define uring_cmd implementation callback functions to have the
io_req_tw_func_t signature to avoid the additional indirect call and
save 8 bytes in struct io_uring_cmd.

v4:
- Rebase on "io_uring: unify task_work cancelation checks"
- Small cleanup in io_fallback_req_func()
- Avoid intermediate variables where IO_URING_CMD_TASK_WORK_ISSUE_FLAG
  is only used once (Christoph)

v3:
- Hide io_kiocb from uring_cmd implementations
- Label the 8 reserved bytes in struct io_uring_cmd (Ming)

v2:
- Define the uring_cmd callbacks with the io_req_tw_func_t signature
  to avoid the macro defining a hidden wrapper function (Christoph)

Caleb Sander Mateos (3):
  io_uring: only call io_should_terminate_tw() once for ctx
  io_uring: add wrapper type for io_req_tw_func_t arg
  io_uring/uring_cmd: avoid double indirect call in task work dispatch

 block/ioctl.c                  |  6 ++++--
 drivers/block/ublk_drv.c       | 18 ++++++++++--------
 drivers/nvme/host/ioctl.c      |  7 ++++---
 fs/btrfs/ioctl.c               |  5 +++--
 fs/fuse/dev_uring.c            |  7 ++++---
 include/linux/io_uring/cmd.h   | 22 +++++++++++++---------
 include/linux/io_uring_types.h |  7 +++++--
 io_uring/futex.c               | 16 +++++++++-------
 io_uring/io_uring.c            | 26 ++++++++++++++------------
 io_uring/io_uring.h            |  4 ++--
 io_uring/msg_ring.c            |  3 ++-
 io_uring/notif.c               |  5 +++--
 io_uring/poll.c                | 11 ++++++-----
 io_uring/poll.h                |  2 +-
 io_uring/rw.c                  |  5 +++--
 io_uring/rw.h                  |  2 +-
 io_uring/timeout.c             | 18 +++++++++++-------
 io_uring/uring_cmd.c           | 17 ++---------------
 io_uring/waitid.c              |  7 ++++---
 19 files changed, 101 insertions(+), 87 deletions(-)

-- 
2.45.2
Re: [PATCH v4 0/3] io_uring/uring_cmd: avoid double indirect call in task work dispatch
Posted by Jens Axboe 3 months ago
On Fri, 31 Oct 2025 14:34:27 -0600, Caleb Sander Mateos wrote:
> Define uring_cmd implementation callback functions to have the
> io_req_tw_func_t signature to avoid the additional indirect call and
> save 8 bytes in struct io_uring_cmd.
> 
> v4:
> - Rebase on "io_uring: unify task_work cancelation checks"
> - Small cleanup in io_fallback_req_func()
> - Avoid intermediate variables where IO_URING_CMD_TASK_WORK_ISSUE_FLAG
>   is only used once (Christoph)
> 
> [...]

Applied, thanks!

[1/3] io_uring: only call io_should_terminate_tw() once for ctx
      commit: 4531d165ee39edb315b42a4a43e29339fa068e51
[2/3] io_uring: add wrapper type for io_req_tw_func_t arg
      commit: c33e779aba6804778c1440192a8033a145ba588d
[3/3] io_uring/uring_cmd: avoid double indirect call in task work dispatch
      commit: 20fb3d05a34b55c8ec28ec3d3555e70c5bc0c72d

Best regards,
-- 
Jens Axboe