2022-05-25 05:59:19 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-12-01 00:57:35 +00:00
|
|
|
|
2022-07-15 12:16:22 -07:00
|
|
|
|
2022-09-30 11:57:39 +05:30
|
|
|
|
2022-05-25 05:59:19 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-20 15:19:44 -06:00
|
|
|
|
2022-09-30 11:57:38 +05:30
|
|
|
|
2025-08-21 12:02:07 +08:00
|
|
|
|
2022-05-25 05:59:19 -06:00
|
|
|
|
2025-06-16 10:46:27 +01:00
|
|
|
|
2022-05-25 05:59:19 -06:00
|
|
|
|
2025-03-21 18:04:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-18 20:41:58 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-19 06:12:48 +00:00
|
|
|
|
2024-03-18 20:41:58 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-21 18:04:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-08 14:22:12 -06:00
|
|
|
|
2024-03-18 20:41:58 -06:00
|
|
|
|
2025-08-22 08:19:56 -06:00
|
|
|
|
2024-03-18 20:41:58 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-21 18:04:33 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-18 22:00:23 +00:00
|
|
|
|
2024-11-03 10:22:43 -07:00
|
|
|
|
2024-03-18 22:00:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
io_uring: move struct io_kiocb from task_struct to io_uring_task
Rather than store the task_struct itself in struct io_kiocb, store
the io_uring specific task_struct. The life times are the same in terms
of io_uring, and this avoids doing some dereferences through the
task_struct. For the hot path of putting local task references, we can
deref req->tctx instead, which we'll need anyway in that function
regardless of whether it's local or remote references.
This is mostly straight forward, except the original task PF_EXITING
check needs a bit of tweaking. task_work is _always_ run from the
originating task, except in the fallback case, where it's run from a
kernel thread. Replace the potentially racy (in case of fallback work)
checks for req->task->flags with current->flags. It's either the still
the original task, in which case PF_EXITING will be sane, or it has
PF_KTHREAD set, in which case it's fallback work. Both cases should
prevent moving forward with the given request.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2024-11-03 10:23:38 -07:00
|
|
|
|
2024-03-18 22:00:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-18 22:00:25 +00:00
|
|
|
|
|
|
|
|
|
2024-03-18 22:00:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-09-28 20:43:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-07-02 16:29:37 +08:00
|
|
|
|
2023-09-28 20:43:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-01-14 08:51:02 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2026-03-02 10:29:10 -07:00
|
|
|
|
2026-01-14 08:51:02 -07:00
|
|
|
|
|
|
|
|
|
2023-09-28 20:43:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-05-15 13:54:42 +01:00
|
|
|
|
2025-10-31 14:34:30 -06:00
|
|
|
|
2023-05-15 13:54:42 +01:00
|
|
|
|
2022-05-25 05:59:19 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-16 10:46:27 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-10-31 14:34:30 -06:00
|
|
|
|
2023-05-15 13:54:42 +01:00
|
|
|
|
2022-05-25 05:59:19 -06:00
|
|
|
|
2023-05-15 13:54:42 +01:00
|
|
|
|
|
|
|
|
|
2022-05-25 05:59:19 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-08-24 23:53:25 +01:00
|
|
|
|
|
|
|
|
|
2022-05-25 05:59:19 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-09-19 12:38:58 -07:00
|
|
|
|
|
|
|
|
|
2022-05-25 05:59:19 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-16 10:46:27 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-09-28 20:43:25 +08:00
|
|
|
|
|
|
|
|
|
2022-05-25 05:59:19 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-08-03 20:07:57 +08:00
|
|
|
|
2025-09-19 12:38:58 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-25 05:59:19 -06:00
|
|
|
|
2025-09-19 12:38:58 -07:00
|
|
|
|
2024-03-18 20:41:58 -06:00
|
|
|
|
2026-03-02 10:29:10 -07:00
|
|
|
|
2026-07-02 16:29:37 +08:00
|
|
|
|
2022-08-23 21:44:41 +05:30
|
|
|
|
2024-03-18 22:00:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-18 22:00:24 +00:00
|
|
|
|
2023-04-12 12:07:36 -06:00
|
|
|
|
2024-03-18 22:00:24 +00:00
|
|
|
|
|
|
|
|
|
2023-04-12 12:07:36 -06:00
|
|
|
|
2022-05-25 05:59:19 -06:00
|
|
|
|
2025-09-19 12:38:58 -07:00
|
|
|
|
2022-05-25 05:59:19 -06:00
|
|
|
|
2025-06-03 14:00:27 -06:00
|
|
|
|
2022-05-25 05:59:19 -06:00
|
|
|
|
2022-08-11 09:11:15 +02:00
|
|
|
|
2025-03-19 06:12:48 +00:00
|
|
|
|
2022-05-25 05:59:19 -06:00
|
|
|
|
2025-06-03 14:00:27 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-08-21 12:02:07 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-03 14:00:27 -06:00
|
|
|
|
2025-08-21 12:02:07 +08:00
|
|
|
|
|
|
|
|
|
2025-08-21 10:33:08 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-03 14:00:27 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-03-19 06:12:48 +00:00
|
|
|
|
|
|
|
|
|
io_uring/uring_cmd: defer SQE copying until it's needed
The previous commit turned on async data for uring_cmd, and did the
basic conversion of setting everything up on the prep side. However, for
a lot of use cases, -EIOCBQUEUED will get returned on issue, as the
operation got successfully queued. For that case, a persistent SQE isn't
needed, as it's just used for issue.
Unless execution goes async immediately, defer copying the double SQE
until it's necessary.
This greatly reduces the overhead of such commands, as evidenced by
a perf diff from before and after this change:
10.60% -8.58% [kernel.vmlinux] [k] io_uring_cmd_prep
where the prep side drops from 10.60% to ~2%, which is more expected.
Performance also rises from ~113M IOPS to ~122M IOPS, bringing us back
to where it was before the async command prep.
Tested-by: Anuj Gupta <anuj20.g@samsung.com>
Reviewed-by: Anuj Gupta <anuj20.g@samsung.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2024-03-20 15:23:47 -06:00
|
|
|
|
2025-06-05 11:39:17 -06:00
|
|
|
|
io_uring/uring_cmd: defer SQE copying until it's needed
The previous commit turned on async data for uring_cmd, and did the
basic conversion of setting everything up on the prep side. However, for
a lot of use cases, -EIOCBQUEUED will get returned on issue, as the
operation got successfully queued. For that case, a persistent SQE isn't
needed, as it's just used for issue.
Unless execution goes async immediately, defer copying the double SQE
until it's necessary.
This greatly reduces the overhead of such commands, as evidenced by
a perf diff from before and after this change:
10.60% -8.58% [kernel.vmlinux] [k] io_uring_cmd_prep
where the prep side drops from 10.60% to ~2%, which is more expected.
Performance also rises from ~113M IOPS to ~122M IOPS, bringing us back
to where it was before the async command prep.
Tested-by: Anuj Gupta <anuj20.g@samsung.com>
Reviewed-by: Anuj Gupta <anuj20.g@samsung.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2024-03-20 15:23:47 -06:00
|
|
|
|
2022-05-25 05:59:19 -06:00
|
|
|
|
|
|
|
|
|
io_uring: add support for IORING_SETUP_SQE_MIXED
Normal rings support 64b SQEs for posting submissions, while certain
features require the ring to be configured with IORING_SETUP_SQE128, as
they need to convey more information per submission. This, in turn,
makes ALL the SQEs be 128b in size. This is somewhat wasteful and
inefficient, particularly when only certain SQEs need to be of the
bigger variant.
This adds support for setting up a ring with mixed SQE sizes, using
IORING_SETUP_SQE_MIXED. When setup in this mode, SQEs posted to the ring
may be either 64b or 128b in size. If a SQE is 128b in size, then opcode
will be set to a variante to indicate that this is the case. Any other
non-128b opcode will assume the SQ's default size.
SQEs on these types of mixed rings may also utilize NOP with skip
success set. This can happen if the ring is one (small) SQE entry away
from wrapping, and an attempt is made to get a 128b SQE. As SQEs must be
contiguous in the SQ ring, a 128b SQE cannot wrap the ring. For this
case, a single NOP SQE should be inserted with the SKIP_SUCCESS flag
set. The kernel will process this as a normal NOP and without posting a
CQE.
Signed-off-by: Keith Busch <kbusch@kernel.org>
[axboe: {} style fix and assign sqe before opcode read]
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-10-16 11:09:38 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-05 11:39:17 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
io_uring: add support for IORING_SETUP_SQE_MIXED
Normal rings support 64b SQEs for posting submissions, while certain
features require the ring to be configured with IORING_SETUP_SQE128, as
they need to convey more information per submission. This, in turn,
makes ALL the SQEs be 128b in size. This is somewhat wasteful and
inefficient, particularly when only certain SQEs need to be of the
bigger variant.
This adds support for setting up a ring with mixed SQE sizes, using
IORING_SETUP_SQE_MIXED. When setup in this mode, SQEs posted to the ring
may be either 64b or 128b in size. If a SQE is 128b in size, then opcode
will be set to a variante to indicate that this is the case. Any other
non-128b opcode will assume the SQ's default size.
SQEs on these types of mixed rings may also utilize NOP with skip
success set. This can happen if the ring is one (small) SQE entry away
from wrapping, and an attempt is made to get a 128b SQE. As SQEs must be
contiguous in the SQ ring, a 128b SQE cannot wrap the ring. For this
case, a single NOP SQE should be inserted with the SKIP_SUCCESS flag
set. The kernel will process this as a normal NOP and without posting a
CQE.
Signed-off-by: Keith Busch <kbusch@kernel.org>
[axboe: {} style fix and assign sqe before opcode read]
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-10-16 11:09:38 -07:00
|
|
|
|
2025-06-05 11:39:17 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-25 05:59:19 -06:00
|
|
|
|
|
|
|
|
|
2022-08-11 09:11:15 +02:00
|
|
|
|
2022-05-25 05:59:19 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-03-08 09:26:13 -07:00
|
|
|
|
2022-05-25 05:59:19 -06:00
|
|
|
|
|
|
|
|
|
2022-07-15 12:16:22 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
io_uring: add support for IORING_SETUP_SQE_MIXED
Normal rings support 64b SQEs for posting submissions, while certain
features require the ring to be configured with IORING_SETUP_SQE128, as
they need to convey more information per submission. This, in turn,
makes ALL the SQEs be 128b in size. This is somewhat wasteful and
inefficient, particularly when only certain SQEs need to be of the
bigger variant.
This adds support for setting up a ring with mixed SQE sizes, using
IORING_SETUP_SQE_MIXED. When setup in this mode, SQEs posted to the ring
may be either 64b or 128b in size. If a SQE is 128b in size, then opcode
will be set to a variante to indicate that this is the case. Any other
non-128b opcode will assume the SQ's default size.
SQEs on these types of mixed rings may also utilize NOP with skip
success set. This can happen if the ring is one (small) SQE entry away
from wrapping, and an attempt is made to get a 128b SQE. As SQEs must be
contiguous in the SQ ring, a 128b SQE cannot wrap the ring. For this
case, a single NOP SQE should be inserted with the SKIP_SUCCESS flag
set. The kernel will process this as a normal NOP and without posting a
CQE.
Signed-off-by: Keith Busch <kbusch@kernel.org>
[axboe: {} style fix and assign sqe before opcode read]
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2025-10-16 11:09:38 -07:00
|
|
|
|
|
|
|
|
|
2022-05-25 05:59:19 -06:00
|
|
|
|
2025-08-07 14:24:18 -06:00
|
|
|
|
2022-05-25 05:59:19 -06:00
|
|
|
|
2025-02-24 12:42:20 +00:00
|
|
|
|
2023-10-16 06:47:43 -07:00
|
|
|
|
io_uring/uring_cmd: allow non-iopoll cmds with IORING_SETUP_IOPOLL
Currently, creating an io_uring with IORING_SETUP_IOPOLL requires all
requests issued to it to support iopoll. This prevents, for example,
using ublk zero-copy together with IORING_SETUP_IOPOLL, as ublk
zero-copy buffer registrations are performed using a uring_cmd. There's
no technical reason why these non-iopoll uring_cmds can't be supported.
They will either complete synchronously or via an external mechanism
that calls io_uring_cmd_done(), io_uring_cmd_post_mshot_cqe32(), or
io_uring_mshot_cmd_post_cqe(), so they don't need to be polled.
Allow uring_cmd requests to be issued to IORING_SETUP_IOPOLL io_urings
even if their files don't implement ->uring_cmd_iopoll(). For these
uring_cmd requests, skip initializing struct io_kiocb's iopoll fields,
don't set REQ_F_IOPOLL, and don't set IO_URING_F_IOPOLL in issue_flags.
Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Reviewed-by: Kanchan Joshi <joshi.k@samsung.com>
Reviewed-by: Anuj Gupta <anuj20.g@samsung.com>
Link: https://patch.msgid.link/20260302172914.2488599-5-csander@purestorage.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2026-03-02 10:29:13 -07:00
|
|
|
|
2026-03-02 10:29:10 -07:00
|
|
|
|
2022-05-25 05:59:19 -06:00
|
|
|
|
2022-08-23 21:44:41 +05:30
|
|
|
|
2025-05-12 13:20:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-08-23 21:44:41 +05:30
|
|
|
|
2022-05-25 05:59:19 -06:00
|
|
|
|
|
|
|
|
|
2025-08-21 12:02:07 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-07-08 14:22:10 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-13 08:24:23 -07:00
|
|
|
|
2024-03-18 20:41:58 -06:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-08 14:48:33 -06:00
|
|
|
|
2022-05-25 05:59:19 -06:00
|
|
|
|
2022-09-30 11:57:38 +05:30
|
|
|
|
|
|
|
|
|
2025-02-28 15:15:13 -07:00
|
|
|
|
|
|
|
|
|
2025-02-24 13:31:09 -08:00
|
|
|
|
2022-09-30 11:57:38 +05:30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-05-23 10:04:46 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-02-24 13:31:10 -08:00
|
|
|
|
2022-09-30 11:57:38 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