From: Leon Romanovsky <leon@kernel.org>
To: David Laight <david.laight.linux@gmail.com>
Cc: Thorsten Blum <thorsten.blum@linux.dev>,
Jason Gunthorpe <jgg@ziepe.ca>,
linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] RDMA/mlx5: Use clamp() in _mlx5r_umr_zap_mkey()
Date: Wed, 11 Mar 2026 10:32:42 +0200 [thread overview]
Message-ID: <20260311083242.GT12611@unreal> (raw)
In-Reply-To: <20260310212440.0df8180c@pumpkin>
On Tue, Mar 10, 2026 at 09:24:40PM +0000, David Laight wrote:
> On Tue, 10 Mar 2026 15:57:28 +0100
> Thorsten Blum <thorsten.blum@linux.dev> wrote:
>
> > Replace min(max()) with clamp(). No functional change.
> >
> > Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> > ---
> > drivers/infiniband/hw/mlx5/umr.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/infiniband/hw/mlx5/umr.c b/drivers/infiniband/hw/mlx5/umr.c
> > index 4e562e0dd9e1..1a6b0ac5c24d 100644
> > --- a/drivers/infiniband/hw/mlx5/umr.c
> > +++ b/drivers/infiniband/hw/mlx5/umr.c
> > @@ -1013,7 +1013,7 @@ static int _mlx5r_umr_zap_mkey(struct mlx5_ib_mr *mr,
> > MLX5_IB_UPD_XLT_ATOMIC;
> > max_log_size = get_max_log_entity_size_cap(dev, access_mode);
> > max_page_shift = order_base_2(mr->ibmr.length);
> > - max_page_shift = min(max(max_page_shift, page_shift), max_log_size);
> > + max_page_shift = clamp(max_page_shift, page_shift, max_log_size);
>
> Is page_shift absolutely guaranteed to be less than (or equal to)
> max_log_size?
I asked same question here.
https://lore.kernel.org/all/20260310184744.GI12611@unreal/
Thanks
prev parent reply other threads:[~2026-03-11 8:32 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-10 14:57 [PATCH] RDMA/mlx5: Use clamp() in _mlx5r_umr_zap_mkey() Thorsten Blum
2026-03-10 18:47 ` Leon Romanovsky
2026-03-10 19:30 ` Thorsten Blum
2026-03-10 21:24 ` David Laight
2026-03-11 8:32 ` Leon Romanovsky [this message]
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=20260311083242.GT12611@unreal \
--to=leon@kernel.org \
--cc=david.laight.linux@gmail.com \
--cc=jgg@ziepe.ca \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=thorsten.blum@linux.dev \
/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.