Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH net-next v2] net/rds: replace tasklets with workqueue
@ 2026-09-24  6:26 Sunny Tiwari
  2026-09-24  6:32 ` sashiko-bot
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Sunny Tiwari @ 2026-09-24  6:26 UTC (permalink / raw)
  To: Santosh Shilimkar, Allison Henderson, netdev, linux-rdma
  Cc: rds-devel, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Simon Horman, Sunny Tiwari

Convert the deprecated send and receive completion tasklets in
net/rds/ib to BH work items queued on system_bh_wq.

In rds_ib_conn_path_shutdown(), replace tasklet_kill() with
disable_work_sync(), and call enable_work() after destroying the CQs so
the work items can be used again when the connection reconnects.

Assisted-by: Gemini
Signed-off-by: Sunny Tiwari <sunnytiwari@google.com>
---
Changes in v2:
- Use system_bh_wq instead of allocating a custom rds_ib_wq workqueue,
  dropping the net/rds/ib.c changes.
- Use from_work() and disable_work_sync() / enable_work() instead of
  cancel_work_sync().
- Link to v1: https://lore.kernel.org/linux-rdma/6b07af04b3ba66a09009e1a0a7b98ec5ec85d3a0.1790109248.git.sunnytiwari@google.com/

 net/rds/ib.h    |  4 ++--
 net/rds/ib_cm.c | 29 +++++++++++++++--------------
 2 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/net/rds/ib.h b/net/rds/ib.h
index 5ff346a1e..190122636 100644
--- a/net/rds/ib.h
+++ b/net/rds/ib.h
@@ -159,8 +159,8 @@ struct rds_ib_connection {
 	atomic_t		i_fastreg_inuse_count;
 
 	/* interrupt handling */
-	struct tasklet_struct	i_send_tasklet;
-	struct tasklet_struct	i_recv_tasklet;
+	struct work_struct	i_send_work;
+	struct work_struct	i_recv_work;
 
 	/* tx */
 	struct rds_ib_work_ring	i_send_ring;
diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c
index 6e3110a04..3ebe13d00 100644
--- a/net/rds/ib_cm.c
+++ b/net/rds/ib_cm.c
@@ -253,7 +253,7 @@ static void rds_ib_cq_comp_handler_recv(struct ib_cq *cq, void *context)
 
 	rds_ib_stats_inc(s_ib_evt_handler_call);
 
-	tasklet_schedule(&ic->i_recv_tasklet);
+	queue_work(system_bh_wq, &ic->i_recv_work);
 }
 
 static void poll_scq(struct rds_ib_connection *ic, struct ib_cq *cq,
@@ -279,9 +279,9 @@ static void poll_scq(struct rds_ib_connection *ic, struct ib_cq *cq,
 	}
 }
 
-static void rds_ib_tasklet_fn_send(unsigned long data)
+static void rds_ib_send_worker(struct work_struct *work)
 {
-	struct rds_ib_connection *ic = (struct rds_ib_connection *)data;
+	struct rds_ib_connection *ic = from_work(ic, work, i_send_work);
 	struct rds_connection *conn = ic->conn;
 
 	rds_ib_stats_inc(s_ib_tasklet_call);
@@ -319,9 +319,9 @@ static void poll_rcq(struct rds_ib_connection *ic, struct ib_cq *cq,
 	}
 }
 
-static void rds_ib_tasklet_fn_recv(unsigned long data)
+static void rds_ib_recv_worker(struct work_struct *work)
 {
-	struct rds_ib_connection *ic = (struct rds_ib_connection *)data;
+	struct rds_ib_connection *ic = from_work(ic, work, i_recv_work);
 	struct rds_connection *conn = ic->conn;
 	struct rds_ib_device *rds_ibdev = ic->rds_ibdev;
 	struct rds_ib_ack_state state;
@@ -381,7 +381,7 @@ static void rds_ib_cq_comp_handler_send(struct ib_cq *cq, void *context)
 
 	rds_ib_stats_inc(s_ib_evt_handler_call);
 
-	tasklet_schedule(&ic->i_send_tasklet);
+	queue_work(system_bh_wq, &ic->i_send_work);
 }
 
 static inline int ibdev_get_unused_vector(struct rds_ib_device *rds_ibdev)
@@ -1099,12 +1099,12 @@ void rds_ib_conn_path_shutdown(struct rds_conn_path *cp)
 		while (!wait_event_timeout(rds_ib_ring_empty_wait,
 					   rds_ib_conn_path_shutdown_check_wait(cp) == 0,
 					   msecs_to_jiffies(1000))) {
-			tasklet_schedule(&ic->i_send_tasklet);
-			tasklet_schedule(&ic->i_recv_tasklet);
+			queue_work(system_bh_wq, &ic->i_send_work);
+			queue_work(system_bh_wq, &ic->i_recv_work);
 		}
 
-		tasklet_kill(&ic->i_send_tasklet);
-		tasklet_kill(&ic->i_recv_tasklet);
+		disable_work_sync(&ic->i_send_work);
+		disable_work_sync(&ic->i_recv_work);
 
 		atomic_set(&ic->i_cq_quiesce, 1);
 
@@ -1123,6 +1123,9 @@ void rds_ib_conn_path_shutdown(struct rds_conn_path *cp)
 			ib_destroy_cq(ic->i_recv_cq);
 		}
 
+		enable_work(&ic->i_send_work);
+		enable_work(&ic->i_recv_work);
+
 		if (ic->rds_ibdev) {
 			/* then free the resources that ib callbacks use */
 			if (ic->i_send_hdrs) {
@@ -1234,10 +1237,8 @@ int rds_ib_conn_alloc(struct rds_connection *conn, gfp_t gfp)
 	}
 
 	INIT_LIST_HEAD(&ic->ib_node);
-	tasklet_init(&ic->i_send_tasklet, rds_ib_tasklet_fn_send,
-		     (unsigned long)ic);
-	tasklet_init(&ic->i_recv_tasklet, rds_ib_tasklet_fn_recv,
-		     (unsigned long)ic);
+	INIT_WORK(&ic->i_send_work, rds_ib_send_worker);
+	INIT_WORK(&ic->i_recv_work, rds_ib_recv_worker);
 	mutex_init(&ic->i_recv_mutex);
 #ifndef KERNEL_HAS_ATOMIC64
 	spin_lock_init(&ic->i_ack_lock);
-- 
2.55.0.1082.g2b9226bbc0-goog


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

* Re: [PATCH net-next v2] net/rds: replace tasklets with workqueue
  2026-09-24  6:26 [PATCH net-next v2] net/rds: replace tasklets with workqueue Sunny Tiwari
@ 2026-09-24  6:32 ` sashiko-bot
  2026-09-25  3:38 ` Allison Henderson
  2026-09-26  1:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: sashiko-bot @ 2026-09-24  6:32 UTC (permalink / raw)
  To: Sunny Tiwari; +Cc: linux-rdma

> Convert the deprecated send and receive completion tasklets in
> net/rds/ib to BH work items queued on system_bh_wq.
> 
> In rds_ib_conn_path_shutdown(), replace tasklet_kill() with
> disable_work_sync(), and call enable_work() after destroying the CQs so
> the work items can be used again when the connection reconnects.
> 
> Assisted-by: Gemini
> Signed-off-by: Sunny Tiwari <sunnytiwari@google.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20cbfc32678019daadd3c67fd75262b8264aa180.1790178801.git.sunnytiwari@google.com?part=1


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

* Re: [PATCH net-next v2] net/rds: replace tasklets with workqueue
  2026-09-24  6:26 [PATCH net-next v2] net/rds: replace tasklets with workqueue Sunny Tiwari
  2026-09-24  6:32 ` sashiko-bot
@ 2026-09-25  3:38 ` Allison Henderson
  2026-09-26  1:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Allison Henderson @ 2026-09-25  3:38 UTC (permalink / raw)
  To: Sunny Tiwari, Santosh Shilimkar, netdev, linux-rdma
  Cc: rds-devel, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Simon Horman

On Thu, 2026-09-24 at 06:26 +0000, Sunny Tiwari wrote:
> Convert the deprecated send and receive completion tasklets in
> net/rds/ib to BH work items queued on system_bh_wq.
> 
> In rds_ib_conn_path_shutdown(), replace tasklet_kill() with
> disable_work_sync(), and call enable_work() after destroying the CQs so
> the work items can be used again when the connection reconnects.
> 
> Assisted-by: Gemini
> Signed-off-by: Sunny Tiwari <sunnytiwari@google.com>

Hi Sunny,

Thanks for the patch.  This looks like a straight forward conversion to me.
I've also run it through the rds selftests on my end, and everything came
up clean.

Reviewed-by: Allison Henderson <achender@kernel.org>
Tested-by: Allison Henderson <achender@kernel.org>

Thanks!
Allison
 
> ---
> Changes in v2:
> - Use system_bh_wq instead of allocating a custom rds_ib_wq workqueue,
>   dropping the net/rds/ib.c changes.
> - Use from_work() and disable_work_sync() / enable_work() instead of
>   cancel_work_sync().
> - Link to v1: https://lore.kernel.org/linux-rdma/6b07af04b3ba66a09009e1a0a7b98ec5ec85d3a0.1790109248.git.sunnytiwari@google.com/
> 
>  net/rds/ib.h    |  4 ++--
>  net/rds/ib_cm.c | 29 +++++++++++++++--------------
>  2 files changed, 17 insertions(+), 16 deletions(-)
> 
> diff --git a/net/rds/ib.h b/net/rds/ib.h
> index 5ff346a1e..190122636 100644
> --- a/net/rds/ib.h
> +++ b/net/rds/ib.h
> @@ -159,8 +159,8 @@ struct rds_ib_connection {
>  	atomic_t		i_fastreg_inuse_count;
>  
>  	/* interrupt handling */
> -	struct tasklet_struct	i_send_tasklet;
> -	struct tasklet_struct	i_recv_tasklet;
> +	struct work_struct	i_send_work;
> +	struct work_struct	i_recv_work;
>  
>  	/* tx */
>  	struct rds_ib_work_ring	i_send_ring;
> diff --git a/net/rds/ib_cm.c b/net/rds/ib_cm.c
> index 6e3110a04..3ebe13d00 100644
> --- a/net/rds/ib_cm.c
> +++ b/net/rds/ib_cm.c
> @@ -253,7 +253,7 @@ static void rds_ib_cq_comp_handler_recv(struct ib_cq *cq, void *context)
>  
>  	rds_ib_stats_inc(s_ib_evt_handler_call);
>  
> -	tasklet_schedule(&ic->i_recv_tasklet);
> +	queue_work(system_bh_wq, &ic->i_recv_work);
>  }
>  
>  static void poll_scq(struct rds_ib_connection *ic, struct ib_cq *cq,
> @@ -279,9 +279,9 @@ static void poll_scq(struct rds_ib_connection *ic, struct ib_cq *cq,
>  	}
>  }
>  
> -static void rds_ib_tasklet_fn_send(unsigned long data)
> +static void rds_ib_send_worker(struct work_struct *work)
>  {
> -	struct rds_ib_connection *ic = (struct rds_ib_connection *)data;
> +	struct rds_ib_connection *ic = from_work(ic, work, i_send_work);
>  	struct rds_connection *conn = ic->conn;
>  
>  	rds_ib_stats_inc(s_ib_tasklet_call);
> @@ -319,9 +319,9 @@ static void poll_rcq(struct rds_ib_connection *ic, struct ib_cq *cq,
>  	}
>  }
>  
> -static void rds_ib_tasklet_fn_recv(unsigned long data)
> +static void rds_ib_recv_worker(struct work_struct *work)
>  {
> -	struct rds_ib_connection *ic = (struct rds_ib_connection *)data;
> +	struct rds_ib_connection *ic = from_work(ic, work, i_recv_work);
>  	struct rds_connection *conn = ic->conn;
>  	struct rds_ib_device *rds_ibdev = ic->rds_ibdev;
>  	struct rds_ib_ack_state state;
> @@ -381,7 +381,7 @@ static void rds_ib_cq_comp_handler_send(struct ib_cq *cq, void *context)
>  
>  	rds_ib_stats_inc(s_ib_evt_handler_call);
>  
> -	tasklet_schedule(&ic->i_send_tasklet);
> +	queue_work(system_bh_wq, &ic->i_send_work);
>  }
>  
>  static inline int ibdev_get_unused_vector(struct rds_ib_device *rds_ibdev)
> @@ -1099,12 +1099,12 @@ void rds_ib_conn_path_shutdown(struct rds_conn_path *cp)
>  		while (!wait_event_timeout(rds_ib_ring_empty_wait,
>  					   rds_ib_conn_path_shutdown_check_wait(cp) == 0,
>  					   msecs_to_jiffies(1000))) {
> -			tasklet_schedule(&ic->i_send_tasklet);
> -			tasklet_schedule(&ic->i_recv_tasklet);
> +			queue_work(system_bh_wq, &ic->i_send_work);
> +			queue_work(system_bh_wq, &ic->i_recv_work);
>  		}
>  
> -		tasklet_kill(&ic->i_send_tasklet);
> -		tasklet_kill(&ic->i_recv_tasklet);
> +		disable_work_sync(&ic->i_send_work);
> +		disable_work_sync(&ic->i_recv_work);
>  
>  		atomic_set(&ic->i_cq_quiesce, 1);
>  
> @@ -1123,6 +1123,9 @@ void rds_ib_conn_path_shutdown(struct rds_conn_path *cp)
>  			ib_destroy_cq(ic->i_recv_cq);
>  		}
>  
> +		enable_work(&ic->i_send_work);
> +		enable_work(&ic->i_recv_work);
> +
>  		if (ic->rds_ibdev) {
>  			/* then free the resources that ib callbacks use */
>  			if (ic->i_send_hdrs) {
> @@ -1234,10 +1237,8 @@ int rds_ib_conn_alloc(struct rds_connection *conn, gfp_t gfp)
>  	}
>  
>  	INIT_LIST_HEAD(&ic->ib_node);
> -	tasklet_init(&ic->i_send_tasklet, rds_ib_tasklet_fn_send,
> -		     (unsigned long)ic);
> -	tasklet_init(&ic->i_recv_tasklet, rds_ib_tasklet_fn_recv,
> -		     (unsigned long)ic);
> +	INIT_WORK(&ic->i_send_work, rds_ib_send_worker);
> +	INIT_WORK(&ic->i_recv_work, rds_ib_recv_worker);
>  	mutex_init(&ic->i_recv_mutex);
>  #ifndef KERNEL_HAS_ATOMIC64
>  	spin_lock_init(&ic->i_ack_lock);


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

* Re: [PATCH net-next v2] net/rds: replace tasklets with workqueue
  2026-09-24  6:26 [PATCH net-next v2] net/rds: replace tasklets with workqueue Sunny Tiwari
  2026-09-24  6:32 ` sashiko-bot
  2026-09-25  3:38 ` Allison Henderson
@ 2026-09-26  1:20 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-09-26  1:20 UTC (permalink / raw)
  To: Sunny Tiwari
  Cc: santosh.shilimkar, achender, netdev, linux-rdma, rds-devel, davem,
	edumazet, kuba, pabeni, horms

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu, 24 Sep 2026 06:26:11 +0000 you wrote:
> Convert the deprecated send and receive completion tasklets in
> net/rds/ib to BH work items queued on system_bh_wq.
> 
> In rds_ib_conn_path_shutdown(), replace tasklet_kill() with
> disable_work_sync(), and call enable_work() after destroying the CQs so
> the work items can be used again when the connection reconnects.
> 
> [...]

Here is the summary with links:
  - [net-next,v2] net/rds: replace tasklets with workqueue
    https://git.kernel.org/netdev/net-next/c/5ccac2330deb

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2026-09-26  1:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-24  6:26 [PATCH net-next v2] net/rds: replace tasklets with workqueue Sunny Tiwari
2026-09-24  6:32 ` sashiko-bot
2026-09-25  3:38 ` Allison Henderson
2026-09-26  1:20 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox