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
41#include <linux/semaphore.h>41#include <linux/semaphore.h>
42#include <linux/slab.h>42#include <linux/slab.h>
43#include <linux/vmalloc.h>43#include <linux/vmalloc.h>
44#include <linux/radix-tree.h>44#include <linux/xarray.h>
45#include <linux/workqueue.h>45#include <linux/workqueue.h>
46#include <linux/mempool.h>46#include <linux/mempool.h>
47#include <linux/interrupt.h>47#include <linux/interrupt.h>
@@ -452,13 +452,6 @@ struct mlx5_qp_table { · 404 unmodified lines
452 struct radix_tree_root tree;452 struct radix_tree_root tree;
453};453};
454 454
455struct mlx5_mkey_table {
456 /* protect radix tree
457 */
458 rwlock_t lock;
459 struct radix_tree_root tree;
460};
461
462struct mlx5_vf_context {455struct mlx5_vf_context {
463 int enabled;456 int enabled;
464 u64 port_guid;457 u64 port_guid;
@@ -546,9 +539,7 @@ struct mlx5_priv { · 81 unmodified lines
546 struct dentry *cmdif_debugfs;539 struct dentry *cmdif_debugfs;
547 /* end: qp staff */540 /* end: qp staff */
548 541
549 /* start: mkey staff */542 struct xarray mkey_table;
550 struct mlx5_mkey_table mkey_table;
551 /* end: mkey staff */
552 543
553 /* start: alloc staff */544 /* start: alloc staff */
554 /* protect buffer alocation according to numa node */545 /* 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
551 return radix_tree_lookup(&dev->priv.qp_table.tree, qpn);551 return radix_tree_lookup(&dev->priv.qp_table.tree, qpn);
552}552}
553 553
554static 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
559int mlx5_core_create_dct(struct mlx5_core_dev *dev,554int mlx5_core_create_dct(struct mlx5_core_dev *dev,
560 struct mlx5_core_dct *qp,555 struct mlx5_core_dct *qp,
561 u32 *in, int inlen,556 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