nvmet: support unbound_wq for RDMA and TCP
Subsystems (2)
cover nvmet: support unbound_wq for RDMA and TCP
hen running nvmf on SMP platform, current nvme target's RDMA and TCP use bounded workqueue to handle IO, but when there is other high workload on the system(eg: kubernetes), the competition between the bounded kworker and other workload is very radical. To decrease the resource race of OS among them, this patchset will enable unbounded workqueue for nvmet-rdma and nvmet-tcp; besides that, it can also get some performance improvement. And this patchset bases on previous discussion from below session.
https://lore.kernel.org/lkml/[email protected]/
Ping Gan (2):
nvmet-tcp: add unbound_wq support for nvmet-tcp
nvmet-rdma: add unbound_wq support for nvmet-rdma
drivers/nvme/target/rdma.c | 10 +++++++++- drivers/nvme/target/tcp.c | 12 ++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-)
Signature · 1 line
2.26.2
PATCH 1/2 nvmet-tcp: add unbound_wq support for nvmet-tcp
To define a module parameter use_unbound_wq to enable unbound workqueue to handle TCP's IO.
--- drivers/nvme/target/tcp.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/nvme/target/tcp.c +10 -2
@@ -73,6 +73,10 @@ device_param_cb(idle_poll_period_usecs, &set_param_ops,MODULE_PARM_DESC (idle_poll_period_usecs,"nvmet tcp io_work poll till idle time period in usecs: Default 0" ); +static bool use_unbound_wq; +module_param (use_unbound_wq, bool,0444 ); +MODULE_PARM_DESC (use_unbound_wq,"use unbound workqueue to handle IO request: Default false" ); +#ifdef CONFIG_NVME_TARGET_TCP_TLS /* * TLS handshake timeout
@@ -2196,9 +2200,13 @@ static const struct nvmet_fabrics_ops nvmet_tcp_ops = {static int __init nvmet_tcp_init (void ) {int ret; +unsigned int flags; + + flags =WQ_MEM_RECLAIM |WQ_HIGHPRI ; +if (use_unbound_wq) + flags |= (WQ_UNBOUND |WQ_SYSFS ); - nvmet_tcp_wq =alloc_workqueue ("nvmet_tcp_wq" , -WQ_MEM_RECLAIM |WQ_HIGHPRI ,0 ); + nvmet_tcp_wq =alloc_workqueue ("nvmet_tcp_wq" , flags,0 );if (!nvmet_tcp_wq)return -ENOMEM ;
Signature · 1 line
2.26.2
Re: [PATCH 1/2] nvmet-tcp: add unbound_wq support for nvmet-tcp
Quoted 4 lines · Ping Gan
To define a module parameter
use_unbound_wqto enable unbound workqueue to handle TCP's IO.Signed-off-by jackygam2001 <[email protected]>
Please use your real name 'Ping Gan' as the author name, not the mail alias.
Quoted 25 lines
--- drivers/nvme/target/tcp.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)drivers/nvme/target/tcp.c +6
-0@@ -73,6 +73,10 @@ device_param_cb(idle_poll_period_usecs, &set_param_ops,MODULE_PARM_DESC (idle_poll_period_usecs,"nvmet tcp io_work poll till idle time period in usecs: Default 0" ); +static bool use_unbound_wq; +module_param (use_unbound_wq, bool,0444 ); +MODULE_PARM_DESC (use_unbound_wq,"use unbound workqueue to handle IO request: Default false" ); +#ifdef CONFIG_NVME_TARGET_TCP_TLS /* * TLS handshake timeout @@ -2196,9 +2200,13 @@ static const struct nvmet_fabrics_ops nvmet_tcp_ops = {static int __init nvmet_tcp_init (void ) {int ret; +unsigned int flags; +
drivers/nvme/target/tcp.c static const struct nvmet_fabrics_ops nvmet_tcp_ops = { · line 2212
Quoted 10 lines
drivers/nvme/target/tcp.c +4
-2+ flags =WQ_MEM_RECLAIM |WQ_HIGHPRI ; +if (use_unbound_wq) + flags |= (WQ_UNBOUND |WQ_SYSFS ); - nvmet_tcp_wq =alloc_workqueue ("nvmet_tcp_wq" , -WQ_MEM_RECLAIM |WQ_HIGHPRI ,0 ); + nvmet_tcp_wq =alloc_workqueue ("nvmet_tcp_wq" , flags,0 );if (!nvmet_tcp_wq)return -ENOMEM ;
Otherwise looks good.
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich
Re: [PATCH 1/2] nvmet-tcp: add unbound_wq support for nvmet-tcp
Quoted 8 lines · Ping Gan
Quoted 4 lines
To define a module parameter
use_unbound_wqto enable unbound workqueue to handle TCP's IO.Signed-off-by jackygam2001 <[email protected]>Please use your real name 'Ping Gan' as the author name, not the mail alias.
Sorry, forgot to change, will do in next version.
PATCH 2/2 nvmet-rdma: add unbound_wq support for nvmet-rdma
In reply to Ping GanTo define a module parameter use_unbound_wq to enable unbound workqueue to handle RDMA's IO of CQ.
--- drivers/nvme/target/rdma.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/nvme/target/rdma.c +9 -1
@@ -155,6 +155,10 @@ static int nvmet_rdma_srq_size = 1024;module_param_cb (srq_size, &srq_size_ops, &nvmet_rdma_srq_size,0644 );MODULE_PARM_DESC (srq_size,"set Shared Receive Queue (SRQ) size, should >= 256 (default: 1024)" ); +static bool use_unbound_wq; +module_param (use_unbound_wq, bool,0444 ); +MODULE_PARM_DESC (use_unbound_wq,"use unbound workqueue to handle IO request: Default false" ); +static DEFINE_IDA (nvmet_rdma_queue_ida);static LIST_HEAD (nvmet_rdma_queue_list);static DEFINE_MUTEX (nvmet_rdma_queue_mutex);
@@ -1259,7 +1263,11 @@ static int nvmet_rdma_create_queue_ib(struct nvmet_rdma_queue *queue)*/ nr_cqe = queue->recv_queue_size +2 * queue->send_queue_size; - queue->cq =ib_cq_pool_get (ndev->device, nr_cqe +1 , +if (use_unbound_wq) + queue->cq =ib_cq_pool_get (ndev->device, nr_cqe +1 , + queue->comp_vector,IB_POLL_UNBOUND_WORKQUEUE ); +else + queue->cq =ib_cq_pool_get (ndev->device, nr_cqe +1 , queue->comp_vector,IB_POLL_WORKQUEUE );if (IS_ERR (queue->cq)) { ret =PTR_ERR (queue->cq);
Signature · 1 line
2.26.2
Re: [PATCH 2/2] nvmet-rdma: add unbound_wq support for nvmet-rdma
Quoted 4 lines · Ping Gan
To define a module parameter
use_unbound_wqto enable unbound workqueue to handle RDMA's IO of CQ.Signed-off-by jackygam2001 <[email protected]>
Similar here, please use your real name as the author name.
Quoted 22 lines
--- drivers/nvme/target/rdma.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)drivers/nvme/target/rdma.c +4
-0@@ -155,6 +155,10 @@ static int nvmet_rdma_srq_size = 1024;module_param_cb (srq_size, &srq_size_ops, &nvmet_rdma_srq_size,0644 );MODULE_PARM_DESC (srq_size,"set Shared Receive Queue (SRQ) size, should >= 256 (default: 1024)" ); +static bool use_unbound_wq; +module_param (use_unbound_wq, bool,0444 ); +MODULE_PARM_DESC (use_unbound_wq,"use unbound workqueue to handle IO request: Default false" ); +static DEFINE_IDA (nvmet_rdma_queue_ida);static LIST_HEAD (nvmet_rdma_queue_list);static DEFINE_MUTEX (nvmet_rdma_queue_mutex);@@ -1259,7 +1263,11 @@ static int nvmet_rdma_create_queue_ib(struct nvmet_rdma_queue *queue)*/ nr_cqe = queue->recv_queue_size +2 * queue->send_queue_size;
drivers/nvme/target/rdma.c static int nvmet_rdma_create_queue_ib(struct nvmet_rdma_queue *queue) · line 1273
Quoted 10 lines
drivers/nvme/target/rdma.c +5
-1- queue->cq =ib_cq_pool_get (ndev->device, nr_cqe +1 , +if (use_unbound_wq) + queue->cq =ib_cq_pool_get (ndev->device, nr_cqe +1 , + queue->comp_vector,IB_POLL_UNBOUND_WORKQUEUE ); +else + queue->cq =ib_cq_pool_get (ndev->device, nr_cqe +1 , queue->comp_vector,IB_POLL_WORKQUEUE );if (IS_ERR (queue->cq)) { ret =PTR_ERR (queue->cq);
Otherwise:
Cheers,
Hannes
Signature · 4 lines
Dr. Hannes Reinecke Kernel Storage Architect [email protected] +49 911 74053 688 SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich