RDMA/mlx5: Fix the flow of a miss in the allocation of a cache ODP MR
authorAharon Landau <aharonl@nvidia.com>
Tue, 15 Feb 2022 17:55:30 +0000 (19:55 +0200)
committerJason Gunthorpe <jgg@nvidia.com>
Wed, 23 Feb 2022 18:59:13 +0000 (14:59 -0400)
When an ODP MR cache entry is empty and trying to allocate it, increment
the ent->miss counter and call to queue_adjust_cache_locked() to verify
the entry is balanced.

Fixes: aad719dcf379 ("RDMA/mlx5: Allow MRs to be created in the cache synchronously")
Link: https://lore.kernel.org/r/09503e295276dcacc92cb1d8aef1ad0961c99dc1.1644947594.git.leonro@nvidia.com
Signed-off-by: Aharon Landau <aharonl@nvidia.com>
Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/mlx5/mr.c

index cd14d1b9dc1dacdb0df3097d91a670ccfa92fb02..bce3cb6af5243880dc7c230564bdd85ddcdd433d 100644 (file)
@@ -577,6 +577,8 @@ struct mlx5_ib_mr *mlx5_mr_cache_alloc(struct mlx5_ib_dev *dev,
        ent = &cache->ent[entry];
        spin_lock_irq(&ent->lock);
        if (list_empty(&ent->head)) {
+               queue_adjust_cache_locked(ent);
+               ent->miss++;
                spin_unlock_irq(&ent->lock);
                mr = create_cache_mr(ent);
                if (IS_ERR(mr))