[PATCH 1/2] nvmet-tcp: add unbound_wq support for nvmet-tcp

Hannes Reinecke hare at suse.de
Wed Jul 17 01:20:24 PDT 2024


On 7/17/24 09:52, Ping Gan wrote:
> To define a module parameter use_unbound_wq to enable unbound
> workqueue to handle TCP's IO.
> 
> Signed-off-by: jackygam2001 <jacky_gam_2001 at 163.com>

Please use your real name 'Ping Gan' as the author name, not the mail alias.

> ---
>   drivers/nvme/target/tcp.c | 12 ++++++++++--
>   1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
> index 5bff0d5464d1..f71d56843e1a 100644
> --- a/drivers/nvme/target/tcp.c
> +++ b/drivers/nvme/target/tcp.c
> @@ -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;
>   
Otherwise looks good.

Reviewed-by: Hannes Reinecke <hare at suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                  Kernel Storage Architect
hare at suse.de                                +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




More information about the Linux-nvme mailing list