From ad7312bb8b8eae249ba2e9926754fc905ab8007a Mon Sep 17 00:00:00 2001 From: Wei Lin Guay Date: Wed, 12 Apr 2017 12:16:39 +0200 Subject: [PATCH] net/rds: use different workqueue for base_conn MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit RDS uses rds_wq for various operations. During ADDR_CHANGE event, each connection queues at least two tasks into this single-threaded workqueue. Furthermore, the TOS connections have dependency on its base connection. Thus, a separate workqueue is created specifically for the base connections to speed up base connection establishment. Orabug: 25521901 Signed-off-by: Wei Lin Guay Reviewed-by: HÃ¥kon Bugge Reviewed-by: Ajaykumar Hotchandani Tested-by: Dib Chatterjee Tested-by: Rosa Isela Lopez Romero --- net/rds/connection.c | 3 +-- net/rds/ib.c | 2 ++ net/rds/rds.h | 1 + net/rds/threads.c | 7 +++++++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/net/rds/connection.c b/net/rds/connection.c index 19e259945d38..00d349b4491a 100644 --- a/net/rds/connection.c +++ b/net/rds/connection.c @@ -243,7 +243,6 @@ static struct rds_connection *__rds_conn_create(struct net *net, } conn->c_trans = trans; - init_waitqueue_head(&conn->c_hs_waitq); for (i = 0; i < RDS_MPATH_WORKERS; i++) { struct rds_conn_path *cp; @@ -254,7 +253,7 @@ static struct rds_connection *__rds_conn_create(struct net *net, if (conn->c_loopback) cp->cp_wq = rds_local_wq; else - cp->cp_wq = rds_wq; + cp->cp_wq = tos ? rds_wq : rds_tos_wq; } ret = trans->conn_alloc(conn, gfp); if (ret) { diff --git a/net/rds/ib.c b/net/rds/ib.c index d34ca3383a39..93425b800dfb 100644 --- a/net/rds/ib.c +++ b/net/rds/ib.c @@ -2099,6 +2099,8 @@ static void rds_ib_unregister_client(void) ib_unregister_client(&rds_ib_client); /* wait for rds_ib_dev_free() to complete */ flush_workqueue(rds_ip_wq); + flush_workqueue(rds_wq); + flush_workqueue(rds_tos_wq); flush_workqueue(rds_local_wq); } diff --git a/net/rds/rds.h b/net/rds/rds.h index 9c2ec849d22e..53e71e1b41b3 100644 --- a/net/rds/rds.h +++ b/net/rds/rds.h @@ -1136,6 +1136,7 @@ extern unsigned int rds_sysctl_shutdown_trace_end_time; int rds_threads_init(void); void rds_threads_exit(void); extern struct workqueue_struct *rds_wq; +extern struct workqueue_struct *rds_tos_wq; extern struct workqueue_struct *rds_local_wq; void rds_queue_reconnect(struct rds_conn_path *cp); void rds_connect_worker(struct work_struct *); diff --git a/net/rds/threads.c b/net/rds/threads.c index dc76c0c90df3..c8a3861052ca 100644 --- a/net/rds/threads.c +++ b/net/rds/threads.c @@ -74,6 +74,8 @@ MODULE_PARM_DESC(rds_conn_hb_timeout, " Connection heartbeat timeout"); */ struct workqueue_struct *rds_wq; EXPORT_SYMBOL_GPL(rds_wq); +struct workqueue_struct *rds_tos_wq; +EXPORT_SYMBOL_GPL(rds_tos_wq); struct workqueue_struct *rds_local_wq; EXPORT_SYMBOL_GPL(rds_local_wq); @@ -352,6 +354,7 @@ void rds_shutdown_worker(struct work_struct *work) void rds_threads_exit(void) { destroy_workqueue(rds_wq); + destroy_workqueue(rds_tos_wq); destroy_workqueue(rds_local_wq); } @@ -361,6 +364,10 @@ int rds_threads_init(void) if (!rds_wq) return -ENOMEM; + rds_tos_wq = create_singlethread_workqueue("krdsd_tos"); + if (!rds_wq) + return -ENOMEM; + rds_local_wq = create_singlethread_workqueue("krdsd_local"); if (!rds_local_wq) return -ENOMEM; -- 2.50.1