All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhu Yanjun <yanjun.zhu@linux.dev>
To: flyingpenghao@gmail.com, dennis.dalessandro@cornelisnetworks.com,
	leon@kernel.org
Cc: linux-rdma@vger.kernel.org, Peng Hao <flyingpeng@tencent.com>
Subject: Re: [PATCH] infiniband/hw/hfi1/tid_rdma: use kmalloc_array_node()
Date: Thu, 25 Jul 2024 13:58:04 +0200	[thread overview]
Message-ID: <f585f4ba-a204-4d29-b0ae-ed80e128a359@linux.dev> (raw)
In-Reply-To: <20240725071716.26136-1-flyingpeng@tencent.com>

在 2024/7/25 9:17, flyingpenghao@gmail.com 写道:
> From: Peng Hao <flyingpeng@tencent.com>
> 
> kmalloc_array_node() is a NUMA-aware version of kmalloc_array that
> has overflow checking and can be used as a replacement for kmalloc_node.
> 
> Signed-off-by: Peng Hao <flyingpeng@tencent.com>
> ---
>   drivers/infiniband/hw/hfi1/tid_rdma.c | 2 +-

drivers/infiniband/sw/rdmavt/mmap.c:124:

ip = kmalloc_node(sizeof(*ip), GFP_KERNEL, rdi->dparms.node);

In the above file, not sure if this kmalloc_node needs to be replaced 
with kmalloc_array_node or not.

Zhu Yanjun

>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/hw/hfi1/tid_rdma.c b/drivers/infiniband/hw/hfi1/tid_rdma.c
> index c465966a1d9c..6b1921f6280b 100644
> --- a/drivers/infiniband/hw/hfi1/tid_rdma.c
> +++ b/drivers/infiniband/hw/hfi1/tid_rdma.c
> @@ -1636,7 +1636,7 @@ static int hfi1_kern_exp_rcv_alloc_flows(struct tid_rdma_request *req,
>   
>   	if (likely(req->flows))
>   		return 0;
> -	flows = kmalloc_node(MAX_FLOWS * sizeof(*flows), gfp,
> +	flows = kmalloc_array_node(MAX_FLOWS, sizeof(*flows), gfp,
>   			     req->rcd->numa_id);
>   	if (!flows)
>   		return -ENOMEM;


  reply	other threads:[~2024-07-25 11:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-25  7:17 [PATCH] infiniband/hw/hfi1/tid_rdma: use kmalloc_array_node() flyingpenghao
2024-07-25 11:58 ` Zhu Yanjun [this message]
2024-07-25 13:46 ` Dean Luick
2024-07-28  7:52   ` Leon Romanovsky
2024-07-28  7:53 ` Leon Romanovsky

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=f585f4ba-a204-4d29-b0ae-ed80e128a359@linux.dev \
    --to=yanjun.zhu@linux.dev \
    --cc=dennis.dalessandro@cornelisnetworks.com \
    --cc=flyingpeng@tencent.com \
    --cc=flyingpenghao@gmail.com \
    --cc=leon@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.