mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Li,Rongqing(ACG CCN)" <lirongqing@baidu.com>
To: Cheng Xu <chengyou@linux.alibaba.com>,
	Kai Shen <kaishen@linux.alibaba.com>,
	Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	"linux-kernel@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 12:07:05 +0000	[thread overview]
Message-ID: <b00bcf9a1aee447eb64d955c52851c05@baidu.com> (raw)
In-Reply-To: <81eac7dd27d344b59da16bd4cef7bc77@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.
> 
> If TLB Miss , or the internal cache misses , does the HCA need to query the MTT?
> 
> [Li,Rongqing]
> 
> > 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.
> >


When kmalloc_node() is called without __GFP_THISNODE and the target node
lacks sufficient memory, SLUB allocates a folio from a different node
other than the requested node.

So I think this is not a problem.

[Li,Rongqing] 



> > 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;

  reply	other threads:[~2026-02-25 12:07 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
2026-02-25 11:46   ` 答复: [外部邮件] " Li,Rongqing(ACG CCN)
2026-02-25 12:07     ` Li,Rongqing(ACG CCN) [this message]
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=b00bcf9a1aee447eb64d955c52851c05@baidu.com \
    --to=lirongqing@baidu.com \
    --cc=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 \
    /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®