net/mlx5: Convert mkey_table to XArray
The lock protecting the data structure does not need to be an rwlock. The only read access to the lock is in an error path, and if that's limiting your scalability, you have bigger performance problems. Eliminate mlx5_mkey_table in favour of using the xarray directly. reg_mr_callback must use GFP_ATOMIC for allocating XArray nodes as it may be called in interrupt context. This also fixes a minor bug where SRCU locking was being used on the radix tree read side, when RCU was needed too. Signed-off-by: Matthew Wilcox <willy@infradead.org> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com> Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Цей коміт міститься в:

зафіксовано
Saeed Mahameed

джерело
82b11f0719
коміт
792c4e9d0b
@@ -768,7 +768,7 @@ static int pagefault_single_data_segment(struct mlx5_ib_dev *dev,
|
||||
bcnt -= *bytes_committed;
|
||||
|
||||
next_mr:
|
||||
mmkey = __mlx5_mr_lookup(dev->mdev, mlx5_base_mkey(key));
|
||||
mmkey = xa_load(&dev->mdev->priv.mkey_table, mlx5_base_mkey(key));
|
||||
if (!mkey_is_eq(mmkey, key)) {
|
||||
mlx5_ib_dbg(dev, "failed to find mkey %x\n", key);
|
||||
ret = -EFAULT;
|
||||
@@ -1686,8 +1686,8 @@ static void num_pending_prefetch_dec(struct mlx5_ib_dev *dev,
|
||||
struct mlx5_core_mkey *mmkey;
|
||||
struct mlx5_ib_mr *mr;
|
||||
|
||||
mmkey = __mlx5_mr_lookup(dev->mdev,
|
||||
mlx5_base_mkey(sg_list[i].lkey));
|
||||
mmkey = xa_load(&dev->mdev->priv.mkey_table,
|
||||
mlx5_base_mkey(sg_list[i].lkey));
|
||||
mr = container_of(mmkey, struct mlx5_ib_mr, mmkey);
|
||||
atomic_dec(&mr->num_pending_prefetch);
|
||||
}
|
||||
@@ -1706,8 +1706,8 @@ static bool num_pending_prefetch_inc(struct ib_pd *pd,
|
||||
struct mlx5_core_mkey *mmkey;
|
||||
struct mlx5_ib_mr *mr;
|
||||
|
||||
mmkey = __mlx5_mr_lookup(dev->mdev,
|
||||
mlx5_base_mkey(sg_list[i].lkey));
|
||||
mmkey = xa_load(&dev->mdev->priv.mkey_table,
|
||||
mlx5_base_mkey(sg_list[i].lkey));
|
||||
if (!mmkey || mmkey->key != sg_list[i].lkey) {
|
||||
ret = false;
|
||||
break;
|
||||
|
Посилання в новій задачі
Заблокувати користувача