提交 48118527 编写于 作者: L Leon Romanovsky 提交者: Jason Gunthorpe

RDMA/restrack: Reduce scope of synchronization lock while updating DB

XArray uses internal lock for updates to XArray. This means that our
external RW lock is needed to ensure that entry is not deleted while we
are performing iteration over list.
Signed-off-by: NLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: NJason Gunthorpe <jgg@mellanox.com>
上级 c5dfe0ea
......@@ -210,13 +210,11 @@ static void rdma_restrack_add(struct rdma_restrack_entry *res)
kref_init(&res->kref);
init_completion(&res->comp);
down_write(&dev->res.rwsem);
ret = rt_xa_alloc_cyclic(&dev->res.xa[res->type], &res->id, res,
&dev->res.next_id[res->type]);
if (!ret)
res->valid = true;
up_write(&dev->res.rwsem);
}
/**
......
......@@ -58,7 +58,8 @@ struct rdma_restrack_entry;
*/
struct rdma_restrack_root {
/*
* @rwsem: Read/write lock to protect lists
* @rwsem: Read/write lock to protect erase of entry.
* Lists and insertions are protected by XArray internal lock.
*/
struct rw_semaphore rwsem;
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册