io_uring: use call_rcu_hurry if signaling an eventfd

Message ID 20221215184138.795576-1-dylany@meta.com
State New
Headers
Series io_uring: use call_rcu_hurry if signaling an eventfd |

Commit Message

Dylan Yudaken Dec. 15, 2022, 6:41 p.m. UTC
  io_uring uses call_rcu in the case it needs to signal an eventfd as a
result of an eventfd signal, since recursing eventfd signals are not
allowed. This should be calling the new call_rcu_hurry API to not delay
the signal.

Signed-off-by: Dylan Yudaken <dylany@meta.com>

Cc: Joel Fernandes (Google) <joel@joelfernandes.org>
Cc: Paul E. McKenney <paulmck@kernel.org>
---
 io_uring/io_uring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


base-commit: 041fae9c105ae342a4245cf1e0dc56a23fbb9d3c
  

Comments

Paul E. McKenney Dec. 15, 2022, 6:44 p.m. UTC | #1
On Thu, Dec 15, 2022 at 10:41:38AM -0800, Dylan Yudaken wrote:
> io_uring uses call_rcu in the case it needs to signal an eventfd as a
> result of an eventfd signal, since recursing eventfd signals are not
> allowed. This should be calling the new call_rcu_hurry API to not delay
> the signal.
> 
> Signed-off-by: Dylan Yudaken <dylany@meta.com>
> 
> Cc: Joel Fernandes (Google) <joel@joelfernandes.org>
> Cc: Paul E. McKenney <paulmck@kernel.org>

Looks good!

Acked-by: Paul E. McKenney <paulmck@kernel.org>

> ---
>  io_uring/io_uring.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
> index b521186efa5c..2cb8c665bab1 100644
> --- a/io_uring/io_uring.c
> +++ b/io_uring/io_uring.c
> @@ -538,7 +538,7 @@ static void io_eventfd_signal(struct io_ring_ctx *ctx)
>  	} else {
>  		atomic_inc(&ev_fd->refs);
>  		if (!atomic_fetch_or(BIT(IO_EVENTFD_OP_SIGNAL_BIT), &ev_fd->ops))
> -			call_rcu(&ev_fd->rcu, io_eventfd_ops);
> +			call_rcu_hurry(&ev_fd->rcu, io_eventfd_ops);
>  		else
>  			atomic_dec(&ev_fd->refs);
>  	}
> 
> base-commit: 041fae9c105ae342a4245cf1e0dc56a23fbb9d3c
> -- 
> 2.30.2
>
  
Jens Axboe Dec. 15, 2022, 6:49 p.m. UTC | #2
On Thu, 15 Dec 2022 10:41:38 -0800, Dylan Yudaken wrote:
> io_uring uses call_rcu in the case it needs to signal an eventfd as a
> result of an eventfd signal, since recursing eventfd signals are not
> allowed. This should be calling the new call_rcu_hurry API to not delay
> the signal.
> 
> Signed-off-by: Dylan Yudaken <dylany@meta.com>
> 
> [...]

Applied, thanks!

[1/1] io_uring: use call_rcu_hurry if signaling an eventfd
      commit: de8f0209fe8064172a86a61537a7b21d6e5334ad

Best regards,
  
Joel Fernandes Dec. 15, 2022, 6:51 p.m. UTC | #3
On Thu, Dec 15, 2022 at 1:49 PM Jens Axboe <axboe@kernel.dk> wrote:
>
>
> On Thu, 15 Dec 2022 10:41:38 -0800, Dylan Yudaken wrote:
> > io_uring uses call_rcu in the case it needs to signal an eventfd as a
> > result of an eventfd signal, since recursing eventfd signals are not
> > allowed. This should be calling the new call_rcu_hurry API to not delay
> > the signal.
> >
> > Signed-off-by: Dylan Yudaken <dylany@meta.com>
> >
> > [...]
>
> Applied, thanks!
>
> [1/1] io_uring: use call_rcu_hurry if signaling an eventfd
>       commit: de8f0209fe8064172a86a61537a7b21d6e5334ad

Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>

thanks,

 - Joel
  

Patch

diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c
index b521186efa5c..2cb8c665bab1 100644
--- a/io_uring/io_uring.c
+++ b/io_uring/io_uring.c
@@ -538,7 +538,7 @@  static void io_eventfd_signal(struct io_ring_ctx *ctx)
 	} else {
 		atomic_inc(&ev_fd->refs);
 		if (!atomic_fetch_or(BIT(IO_EVENTFD_OP_SIGNAL_BIT), &ev_fd->ops))
-			call_rcu(&ev_fd->rcu, io_eventfd_ops);
+			call_rcu_hurry(&ev_fd->rcu, io_eventfd_ops);
 		else
 			atomic_dec(&ev_fd->refs);
 	}