History

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.

Matthew Wilcox committed 7 years ago

Commit 792c4e91 parent 82b11f07 files · +31 −60Browse files

Showing the changes to include/linux (2 of 7 files). Show all

Unified · Split

2 files
  1. include/linux/mlx5/driver.h +2 −11
  2. include/linux/mlx5/qp.h +0 −5
include/linux/mlx5/driver.h+2−11
@@ -41,7 +41,7 @@ · 40 unmodified lines
4141 #include <linux/semaphore.h>
4242 #include <linux/slab.h>
4343 #include <linux/vmalloc.h>
44−#include <linux/radix-tree.h>
44+#include <linux/xarray.h>
4545 #include <linux/workqueue.h>
4646 #include <linux/mempool.h>
4747 #include <linux/interrupt.h>
@@ -452,13 +452,6 @@ struct mlx5_qp_table { · 404 unmodified lines
452452 struct radix_tree_root tree;
453453 };
454454
455−struct mlx5_mkey_table {
456− /* protect radix tree
457− */
458− rwlock_t lock;
459− struct radix_tree_root tree;
460−};
461−
462455 struct mlx5_vf_context {
463456 int enabled;
464457 u64 port_guid;
@@ -546,9 +539,7 @@ struct mlx5_priv { · 81 unmodified lines
546539 struct dentry *cmdif_debugfs;
547540 /* end: qp staff */
548541
549− /* start: mkey staff */
550− struct mlx5_mkey_table mkey_table;
551− /* end: mkey staff */
542+ struct xarray mkey_table;
552543
553544 /* start: alloc staff */
554545 /* protect buffer alocation according to numa node */
include/linux/mlx5/qp.h+0−5
@@ -551,11 +551,6 @@ static inline struct mlx5_core_qp *__mlx5_qp_lookup(struct mlx5_core_dev *dev, u · 550 unmodified lines
551551 return radix_tree_lookup(&dev->priv.qp_table.tree, qpn);
552552 }
553553
554−static inline struct mlx5_core_mkey *__mlx5_mr_lookup(struct mlx5_core_dev *dev, u32 key)
555−{
556− return radix_tree_lookup(&dev->priv.mkey_table.tree, key);
557−}
558−
559554 int mlx5_core_create_dct(struct mlx5_core_dev *dev,
560555 struct mlx5_core_dct *qp,
561556 u32 *in, int inlen,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t