mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 02:39:48 +00:00
net/mlx4_core: Use RCU to perform radix tree lookup for SRQ
Radix tree lookup can be performed without locking.
Fixes: 225c7b1fee
("IB/mlx4: Add a driver Mellanox ConnectX InfiniBand adapters")
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Suggested-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
57c970c2e8
commit
30353bfc43
1 changed files with 5 additions and 9 deletions
|
@ -45,15 +45,12 @@ void mlx4_srq_event(struct mlx4_dev *dev, u32 srqn, int event_type)
|
|||
struct mlx4_srq_table *srq_table = &mlx4_priv(dev)->srq_table;
|
||||
struct mlx4_srq *srq;
|
||||
|
||||
spin_lock(&srq_table->lock);
|
||||
|
||||
rcu_read_lock();
|
||||
srq = radix_tree_lookup(&srq_table->tree, srqn & (dev->caps.num_srqs - 1));
|
||||
rcu_read_unlock();
|
||||
if (srq)
|
||||
atomic_inc(&srq->refcount);
|
||||
|
||||
spin_unlock(&srq_table->lock);
|
||||
|
||||
if (!srq) {
|
||||
else {
|
||||
mlx4_warn(dev, "Async event for bogus SRQ %08x\n", srqn);
|
||||
return;
|
||||
}
|
||||
|
@ -301,12 +298,11 @@ struct mlx4_srq *mlx4_srq_lookup(struct mlx4_dev *dev, u32 srqn)
|
|||
{
|
||||
struct mlx4_srq_table *srq_table = &mlx4_priv(dev)->srq_table;
|
||||
struct mlx4_srq *srq;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&srq_table->lock, flags);
|
||||
rcu_read_lock();
|
||||
srq = radix_tree_lookup(&srq_table->tree,
|
||||
srqn & (dev->caps.num_srqs - 1));
|
||||
spin_unlock_irqrestore(&srq_table->lock, flags);
|
||||
rcu_read_unlock();
|
||||
|
||||
return srq;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue