From: Cheng Xu <chengyou@linux.alibaba.com>
To: lirongqing <lirongqing@baidu.com>,
Kai Shen <kaishen@linux.alibaba.com>,
Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>,
linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH][rdma-next] RDMA/erdma: Use NUMA-aware allocation for MTT tables
Date: Wed, 25 Feb 2026 19:33:49 +0800 [thread overview]
Message-ID: <7cfd31d3-fe40-8b2d-cea8-14748db5f35b@linux.alibaba.com> (raw)
In-Reply-To: <20260225085143.1721-1-lirongqing@baidu.com>
On 2/25/26 4:51 PM, lirongqing wrote:
> From: Li RongQing <lirongqing@baidu.com>
>
> Currently, MTT (Memory Translation Table) buffers are allocated without
> NUMA awareness using kzalloc() and vzalloc(), which allocate memory on
> the NUMA node of the calling CPU. This can lead to cross-node memory
> access latencies if the erdma device is attached to a different NUMA
> socket.
>
> Switch to kzalloc_node() and vzalloc_node() to ensure MTT buffers are
> allocated on the local NUMA node of the PCIe device (dev->attrs.numa_node).
> This reduces latency for hardware access and improves performance.
>
> Signed-off-by: Li RongQing <lirongqing@baidu.com>
> ---
> drivers/infiniband/hw/erdma/erdma_verbs.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
Hi, Li RongQing,
Thanks for the patch. However, I think it is better to keep the current
behavior, for the following reasons:
1. This path is in the control plane, so allocating memory from a remote
NUMA node should not have a noticeable performance impact.
2. With this change, the driver may fail the allocation when the local NUMA
node is out of memory, even if other nodes still have available memory.
Thanks,
Cheng Xu
> diff --git a/drivers/infiniband/hw/erdma/erdma_verbs.c b/drivers/infiniband/hw/erdma/erdma_verbs.c
> index 9f74aad..58da6ef 100644
> --- a/drivers/infiniband/hw/erdma/erdma_verbs.c
> +++ b/drivers/infiniband/hw/erdma/erdma_verbs.c
> @@ -604,7 +604,7 @@ static struct erdma_mtt *erdma_create_cont_mtt(struct erdma_dev *dev,
> return ERR_PTR(-ENOMEM);
>
> mtt->size = size;
> - mtt->buf = kzalloc(mtt->size, GFP_KERNEL);
> + mtt->buf = kzalloc_node(mtt->size, GFP_KERNEL, dev->attrs.numa_node);
> if (!mtt->buf)
> goto err_free_mtt;
>
> @@ -729,7 +729,7 @@ static struct erdma_mtt *erdma_create_scatter_mtt(struct erdma_dev *dev,
> return ERR_PTR(-ENOMEM);
>
> mtt->size = ALIGN(size, PAGE_SIZE);
> - mtt->buf = vzalloc(mtt->size);
> + mtt->buf = vzalloc_node(mtt->size, dev->attrs.numa_node);
> mtt->continuous = false;
> if (!mtt->buf)
> goto err_free_mtt;
next prev parent reply other threads:[~2026-02-25 11:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-25 8:51 lirongqing
2026-02-25 11:33 ` Cheng Xu [this message]
2026-02-25 11:46 ` 答复: [外部邮件] " Li,Rongqing(ACG CCN)
2026-02-25 12:07 ` Li,Rongqing(ACG CCN)
2026-02-26 1:50 ` Cheng Xu
2026-02-26 7:09 ` Leon Romanovsky
2026-02-26 7:59 ` Cheng Xu
2026-02-27 14:55 ` Jason Gunthorpe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7cfd31d3-fe40-8b2d-cea8-14748db5f35b@linux.alibaba.com \
--to=chengyou@linux.alibaba.com \
--cc=jgg@ziepe.ca \
--cc=kaishen@linux.alibaba.com \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=lirongqing@baidu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®