Skip to content

Commit 86457a9

Browse files
aharonl-nvidiajgunthorpe
authored andcommitted
RDMA/mlx5: Replace cache list with Xarray
The Xarray allows us to store the cached mkeys in memory efficient way. Entries are reserved in the Xarray using xa_cmpxchg before calling to the upcoming callbacks to avoid allocations in interrupt context. The xa_cmpxchg can sleep when using GFP_KERNEL, so we call it in a loop to ensure one reserved entry for each process trying to reserve. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Aharon Landau <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 17ae355 commit 86457a9

File tree

2 files changed

+152
-88
lines changed

2 files changed

+152
-88
lines changed

drivers/infiniband/hw/mlx5/mlx5_ib.h

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -651,8 +651,6 @@ struct mlx5_ib_mr {
651651
struct {
652652
u32 out[MLX5_ST_SZ_DW(create_mkey_out)];
653653
struct mlx5_async_work cb_work;
654-
/* Cache list element */
655-
struct list_head list;
656654
};
657655

658656
/* Used only by kernel MRs (umem == NULL) */
@@ -744,7 +742,8 @@ struct umr_common {
744742

745743
struct mlx5_cache_ent {
746744
struct xarray mkeys;
747-
struct list_head head;
745+
unsigned long stored;
746+
unsigned long reserved;
748747

749748
char name[4];
750749
u32 order;
@@ -756,18 +755,13 @@ struct mlx5_cache_ent {
756755
u8 fill_to_high_water:1;
757756

758757
/*
759-
* - available_mrs is the length of list head, ie the number of MRs
760-
* available for immediate allocation.
761-
* - total_mrs is available_mrs plus all in use MRs that could be
758+
* - total_mrs is stored mkeys plus all in use MRs that could be
762759
* returned to the cache.
763-
* - limit is the low water mark for available_mrs, 2* limit is the
760+
* - limit is the low water mark for stored mkeys, 2* limit is the
764761
* upper water mark.
765-
* - pending is the number of MRs currently being created
766762
*/
767763
u32 total_mrs;
768-
u32 available_mrs;
769764
u32 limit;
770-
u32 pending;
771765

772766
/* Statistics */
773767
u32 miss;

0 commit comments

Comments
 (0)