diff mbox series

[v1,1/3] io_uring: add IORING_ENTER_NO_IOWAIT flag

Message ID 20240816180145.14561-2-dw@davidwei.uk (mailing list archive)
State New
Headers show
Series io_uring: add option to not set in_iowait | expand

Commit Message

David Wei Aug. 16, 2024, 6:01 p.m. UTC
Add IORING_ENTER_NO_IOWAIT flag. If this is set then io_uring will not
set current->in_iowait prior to waiting.

Signed-off-by: David Wei <dw@davidwei.uk>
---
 include/uapi/linux/io_uring.h | 1 +
 io_uring/io_uring.c           | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

Comments

Jens Axboe Aug. 16, 2024, 6:35 p.m. UTC | #1
On 8/16/24 12:01 PM, David Wei wrote:
> Add IORING_ENTER_NO_IOWAIT flag. If this is set then io_uring will not
> set current->in_iowait prior to waiting.

Ordering is a bit wrong here - with this patch, you can set
IORING_ENTER_NO_IOWAIT and it will appear to work (eg no -EINVAL
return), but it won't actually work.

I'd just squash patch 1 + 2, as just having patch 2 with the uapi hunk
be patch 1 leaves patch 2 as just adding it to the flags check.

And at that point you'd probably just want to fold in patch 3 as well,
not sure that makes sense as a separate patch.
diff mbox series

Patch

diff --git a/include/uapi/linux/io_uring.h b/include/uapi/linux/io_uring.h
index 48c440edf674..2552d4927511 100644
--- a/include/uapi/linux/io_uring.h
+++ b/include/uapi/linux/io_uring.h
@@ -508,6 +508,7 @@  struct io_cqring_offsets {
 #define IORING_ENTER_EXT_ARG		(1U << 3)
 #define IORING_ENTER_REGISTERED_RING	(1U << 4)
 #define IORING_ENTER_ABS_TIMER		(1U << 5)
+#define IORING_ENTER_NO_IOWAIT		(1U << 6)
 
 /*
  * Passed in for io_uring_setup(2). Copied back with updated info on success
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index 20229e72b65c..4cc905b228a5 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -3155,7 +3155,7 @@  SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit,
 	if (unlikely(flags & ~(IORING_ENTER_GETEVENTS | IORING_ENTER_SQ_WAKEUP |
 			       IORING_ENTER_SQ_WAIT | IORING_ENTER_EXT_ARG |
 			       IORING_ENTER_REGISTERED_RING |
-			       IORING_ENTER_ABS_TIMER)))
+			       IORING_ENTER_ABS_TIMER | IORING_ENTER_NO_IOWAIT)))
 		return -EINVAL;
 
 	/*