From: Leon Romanovsky <leon@kernel.org>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: Shay Drory <shayd@nvidia.com>, linux-rdma@vger.kernel.org
Subject: Re: [PATCH rdma-next] RDMA/mlx5: Implement mkeys management via LIFO queue
Date: Thu, 21 Sep 2023 09:43:21 +0300 [thread overview]
Message-ID: <20230921064321.GA1642130@unreal> (raw)
In-Reply-To: <20230920163637.GE13733@nvidia.com>
On Wed, Sep 20, 2023 at 01:36:37PM -0300, Jason Gunthorpe wrote:
> On Wed, Sep 20, 2023 at 12:54:56PM +0300, Leon Romanovsky wrote:
> > From: Shay Drory <shayd@nvidia.com>
> >
> > Currently, mkeys are managed via xarray. This implementation leads to
> > a degradation in cases many MRs are unregistered in parallel, due to xarray
> > internal implementation, for example: deregistration 1M MRs via 64 threads
> > is taking ~15% more time[1].
> >
> > Hence, implement mkeys management via LIFO queue, which solved the
> > degradation.
> >
> > [1]
> > 2.8us in kernel v5.19 compare to 3.2us in kernel v6.4
> >
> > Signed-off-by: Shay Drory <shayd@nvidia.com>
> > Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
> > ---
> > drivers/infiniband/hw/mlx5/mlx5_ib.h | 19 +-
> > drivers/infiniband/hw/mlx5/mr.c | 324 ++++++++++++---------------
> > drivers/infiniband/hw/mlx5/umr.c | 4 +-
> > 3 files changed, 167 insertions(+), 180 deletions(-)
> >
> > diff --git a/drivers/infiniband/hw/mlx5/mlx5_ib.h b/drivers/infiniband/hw/mlx5/mlx5_ib.h
> > index 16713baf0d06..261c86fe6433 100644
> > --- a/drivers/infiniband/hw/mlx5/mlx5_ib.h
> > +++ b/drivers/infiniband/hw/mlx5/mlx5_ib.h
> > @@ -753,10 +753,23 @@ struct umr_common {
> > unsigned int state;
> > };
> >
> > +#define NUM_MKEYS_PER_PAGE (PAGE_SIZE / sizeof(u32))
> > +
> > +struct mlx5_mkeys_page {
> > + u32 mkeys[NUM_MKEYS_PER_PAGE];
> > + struct list_head list;
> > +};
>
> Er, isn't the point of this to be PAGE_SIZE big?
The more important part is preallocation of whole struct mlx5_mkeys_page
to hold multiple keys in one shot. The PAGE_SIZE alignment can
definitely help to make it even more efficient, but it is not culprit
of this patch.
I will change.
Thanks
>
> Add an
>
> static_assert(sizeof(struct mlx5_mkeys_page) == PAGE_SIZE)
>
> And fix it so it is true..
>
> Jason
prev parent reply other threads:[~2023-09-21 18:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-20 9:54 [PATCH rdma-next] RDMA/mlx5: Implement mkeys management via LIFO queue Leon Romanovsky
2023-09-20 16:36 ` Jason Gunthorpe
2023-09-21 6:43 ` 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=20230921064321.GA1642130@unreal \
--to=leon@kernel.org \
--cc=jgg@nvidia.com \
--cc=linux-rdma@vger.kernel.org \
--cc=shayd@nvidia.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