public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Dean Luick <dean.luick@cornelisnetworks.com>
Cc: flyingpenghao@gmail.com, dennis.dalessandro@cornelisnetworks.com,
	linux-rdma@vger.kernel.org, Peng Hao <flyingpeng@tencent.com>
Subject: Re: [PATCH] infiniband/hw/hfi1/tid_rdma: use kmalloc_array_node()
Date: Sun, 28 Jul 2024 10:52:47 +0300	[thread overview]
Message-ID: <20240728075247.GB4296@unreal> (raw)
In-Reply-To: <db63e419-8185-4c45-8e59-2756013c73c3@cornelisnetworks.com>

On Thu, Jul 25, 2024 at 08:46:30AM -0500, Dean Luick wrote:
> On 7/25/2024 2:17 AM, flyingpenghao@gmail.com wrote:
> > 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 +-
> >  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;
> 
> This is clearly not going to overflow.  I see no reason to change it.
> 
> However, I don't know the current policy on such replacements.

There is no policy. My preference is to change if other changes are done in
the same area, but do not change something that is not broken.

Thanks

> 
> -Dean
> 
> External recipient
> 

  reply	other threads:[~2024-07-28  7:52 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
2024-07-25 13:46 ` Dean Luick
2024-07-28  7:52   ` Leon Romanovsky [this message]
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=20240728075247.GB4296@unreal \
    --to=leon@kernel.org \
    --cc=dean.luick@cornelisnetworks.com \
    --cc=dennis.dalessandro@cornelisnetworks.com \
    --cc=flyingpeng@tencent.com \
    --cc=flyingpenghao@gmail.com \
    --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