linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] io_uring: make sqpoll wakeup possible with getevents
@ 2019-09-12 16:08 Jens Axboe
  2019-09-12 20:15 ` Jeff Moyer
  0 siblings, 1 reply; 2+ messages in thread
From: Jens Axboe @ 2019-09-12 16:08 UTC (permalink / raw)
  To: linux-block; +Cc: Lewis Baker

The way the logic is setup in io_uring_enter() means that you can't wake
up the SQ poller thread while at the same time waiting (or polling) for
completions afterwards. There's no reason for that to be the case.

Reported-by: Lewis Baker <lbaker@fb.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

--

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 4bc3ee4ea81f..3c8859d417eb 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -3356,15 +3356,12 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit,
 	 * Just return the requested submit count, and wake the thread if
 	 * we were asked to.
 	 */
+	ret = 0;
 	if (ctx->flags & IORING_SETUP_SQPOLL) {
 		if (flags & IORING_ENTER_SQ_WAKEUP)
 			wake_up(&ctx->sqo_wait);
 		submitted = to_submit;
-		goto out_ctx;
-	}
-
-	ret = 0;
-	if (to_submit) {
+	} else if (to_submit) {
 		bool block_for_last = false;
 
 		to_submit = min(to_submit, ctx->sq_entries);
@@ -3394,7 +3391,6 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit,
 		}
 	}
 
-out_ctx:
 	io_ring_drop_ctx_refs(ctx, 1);
 out_fput:
 	fdput(f);

-- 
Jens Axboe


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] io_uring: make sqpoll wakeup possible with getevents
  2019-09-12 16:08 [PATCH] io_uring: make sqpoll wakeup possible with getevents Jens Axboe
@ 2019-09-12 20:15 ` Jeff Moyer
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Moyer @ 2019-09-12 20:15 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, Lewis Baker

Jens Axboe <axboe@kernel.dk> writes:

> The way the logic is setup in io_uring_enter() means that you can't wake
> up the SQ poller thread while at the same time waiting (or polling) for
> completions afterwards. There's no reason for that to be the case.
>
> Reported-by: Lewis Baker <lbaker@fb.com>
> Signed-off-by: Jens Axboe <axboe@kernel.dk>

Reviewed-by: Jeff Moyer <jmoyer@redhat.com>

>
> --
>
> diff --git a/fs/io_uring.c b/fs/io_uring.c
> index 4bc3ee4ea81f..3c8859d417eb 100644
> --- a/fs/io_uring.c
> +++ b/fs/io_uring.c
> @@ -3356,15 +3356,12 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit,
>  	 * Just return the requested submit count, and wake the thread if
>  	 * we were asked to.
>  	 */
> +	ret = 0;
>  	if (ctx->flags & IORING_SETUP_SQPOLL) {
>  		if (flags & IORING_ENTER_SQ_WAKEUP)
>  			wake_up(&ctx->sqo_wait);
>  		submitted = to_submit;
> -		goto out_ctx;
> -	}
> -
> -	ret = 0;
> -	if (to_submit) {
> +	} else if (to_submit) {
>  		bool block_for_last = false;
>  
>  		to_submit = min(to_submit, ctx->sq_entries);
> @@ -3394,7 +3391,6 @@ SYSCALL_DEFINE6(io_uring_enter, unsigned int, fd, u32, to_submit,
>  		}
>  	}
>  
> -out_ctx:
>  	io_ring_drop_ctx_refs(ctx, 1);
>  out_fput:
>  	fdput(f);

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-09-12 20:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-12 16:08 [PATCH] io_uring: make sqpoll wakeup possible with getevents Jens Axboe
2019-09-12 20:15 ` Jeff Moyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).