[PATCH 4/4] nvme-tcp: switch to 'cpu' affinity scope for unbound workqueues
Hannes Reinecke
hare at kernel.org
Wed Jul 3 06:50:21 PDT 2024
We should switch to the 'cpu' affinity scope when using the 'wq_unbound'
parameter as this allows us to keep I/O locality and improve performance.
Signed-off-by: Hannes Reinecke <hare at kernel.org>
---
drivers/nvme/host/tcp.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index df184004a514..889a5a28e3b7 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -2812,6 +2812,11 @@ static struct nvme_tcp_ctrl *nvme_tcp_alloc_ctrl(struct device *dev,
nvme_put_ctrl(&ctrl->ctrl);
return ERR_PTR(-ENOMEM);
}
+ if (wq_unbound) {
+ ret = workqueue_unbound_affinity_scope(ctrl->io_wq, WQ_AFFN_CPU);
+ if (ret)
+ pr_warn("Failed to set 'cpu' workqueue affinity\n");
+ }
return ctrl;
out_kfree_queues:
--
2.35.3
More information about the Linux-nvme
mailing list