RDMA/mlx5: Cache all user cacheable mkeys on dereg MR flow
authorMichael Guralnik <michaelgur@nvidia.com>
Wed, 25 Jan 2023 22:28:06 +0000 (00:28 +0200)
committerJason Gunthorpe <jgg@nvidia.com>
Fri, 27 Jan 2023 17:04:10 +0000 (13:04 -0400)
commitdd1b913fb0d0e3e6d55e92d2319d954474dd66ac
treed56f7f15b29aa5fd0dc5f613e2a44f0fcb091486
parent73d09b2fe8336f5f37935e46418666ddbcd3c343
RDMA/mlx5: Cache all user cacheable mkeys on dereg MR flow

Currently, when dereging an MR, if the mkey doesn't belong to a cache
entry, it will be destroyed.  As a result, the restart of applications
with many non-cached mkeys is not efficient since all the mkeys are
destroyed and then recreated.  This process takes a long time (for 100,000
MRs, it is ~20 seconds for dereg and ~28 seconds for re-reg).

To shorten the restart runtime, insert all cacheable mkeys to the cache.
If there is no fitting entry to the mkey properties, create a temporary
entry that fits it.

After a predetermined timeout, the cache entries will shrink to the
initial high limit.

The mkeys will still be in the cache when consuming them again after an
application restart. Therefore, the registration will be much faster
(for 100,000 MRs, it is ~4 seconds for dereg and ~5 seconds for re-reg).

The temporary cache entries created to store the non-cache mkeys are not
exposed through sysfs like the default cache entries.

Link: https://lore.kernel.org/r/20230125222807.6921-6-michaelgur@nvidia.com
Signed-off-by: Michael Guralnik <michaelgur@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/mlx5/mlx5_ib.h
drivers/infiniband/hw/mlx5/mr.c