Skip to content

Commit

Permalink
RDMA/mlx5: Implement mkeys management via LIFO queue
Browse files Browse the repository at this point in the history
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>
Link: https://lore.kernel.org/r/fde3d4cfab0f32f0ccb231cd113298256e1502c5.1695283384.git.leon@kernel.org
Signed-off-by: Leon Romanovsky <leon@kernel.org>
  • Loading branch information
Shay Drory authored and Leon Romanovsky committed Sep 26, 2023
1 parent cb7ab78 commit 57e7071
Show file tree
Hide file tree
Showing 3 changed files with 169 additions and 180 deletions.
21 changes: 18 additions & 3 deletions drivers/infiniband/hw/mlx5/mlx5_ib.h
Original file line number Diff line number Diff line change
Expand Up @@ -753,10 +753,25 @@ struct umr_common {
unsigned int state;
};

#define NUM_MKEYS_PER_PAGE \
((PAGE_SIZE - sizeof(struct list_head)) / sizeof(u32))

struct mlx5_mkeys_page {
u32 mkeys[NUM_MKEYS_PER_PAGE];
struct list_head list;
};
static_assert(sizeof(struct mlx5_mkeys_page) == PAGE_SIZE);

struct mlx5_mkeys_queue {
struct list_head pages_list;
u32 num_pages;
unsigned long ci;
spinlock_t lock; /* sync list ops */
};

struct mlx5_cache_ent {
struct xarray mkeys;
unsigned long stored;
unsigned long reserved;
struct mlx5_mkeys_queue mkeys_queue;
u32 pending;

char name[4];

Expand Down
Loading

0 comments on commit 57e7071

Please sign in to comment.