diff options
author | Leon Romanovsky <leonro@mellanox.com> | 2020-09-22 12:11:05 +0300 |
---|---|---|
committer | Jason Gunthorpe <jgg@nvidia.com> | 2020-09-22 19:47:35 -0300 |
commit | c34a23c28c6b0045b1f21649de30f68da72547af (patch) | |
tree | b4b0772aaa3fa5f49f68933978076b81102f8b38 /drivers/infiniband/core/verbs.c | |
parent | 13ef5539def732dc7b9c58c320d97a0a95b52634 (diff) | |
download | linux-c34a23c28c6b0045b1f21649de30f68da72547af.tar.bz2 |
RDMA/restrack: Simplify restrack tracking in kernel flows
Have a single rdma_restrack_add() that adds an entry, there is no reason
to split the user/kernel here, the rdma_restrack_set_task() is responsible
for this difference.
This patch prepares the code to the future requirement of making restrack
is mandatory for managing ib objects.
Link: https://lore.kernel.org/r/20200922091106.2152715-5-leon@kernel.org
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'drivers/infiniband/core/verbs.c')
-rw-r--r-- | drivers/infiniband/core/verbs.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c index 2607c410b09f..8117e551a866 100644 --- a/drivers/infiniband/core/verbs.c +++ b/drivers/infiniband/core/verbs.c @@ -281,7 +281,7 @@ struct ib_pd *__ib_alloc_pd(struct ib_device *device, unsigned int flags, kfree(pd); return ERR_PTR(ret); } - rdma_restrack_kadd(&pd->res); + rdma_restrack_add(&pd->res); if (device->attrs.device_cap_flags & IB_DEVICE_LOCAL_DMA_LKEY) pd->local_dma_lkey = device->local_dma_lkey; @@ -2008,7 +2008,7 @@ struct ib_cq *__ib_create_cq(struct ib_device *device, return ERR_PTR(ret); } - rdma_restrack_kadd(&cq->res); + rdma_restrack_add(&cq->res); return cq; } EXPORT_SYMBOL(__ib_create_cq); @@ -2081,7 +2081,8 @@ struct ib_mr *ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, atomic_inc(&pd->usecnt); rdma_restrack_new(&mr->res, RDMA_RESTRACK_MR); - rdma_restrack_kadd(&mr->res); + rdma_restrack_set_task(&mr->res, pd->res.kern_name); + rdma_restrack_add(&mr->res); return mr; } @@ -2164,7 +2165,8 @@ struct ib_mr *ib_alloc_mr(struct ib_pd *pd, enum ib_mr_type mr_type, mr->sig_attrs = NULL; rdma_restrack_new(&mr->res, RDMA_RESTRACK_MR); - rdma_restrack_kadd(&mr->res); + rdma_restrack_set_task(&mr->res, pd->res.kern_name); + rdma_restrack_add(&mr->res); out: trace_mr_alloc(pd, mr_type, max_num_sg, mr); return mr; @@ -2224,7 +2226,8 @@ struct ib_mr *ib_alloc_mr_integrity(struct ib_pd *pd, mr->sig_attrs = sig_attrs; rdma_restrack_new(&mr->res, RDMA_RESTRACK_MR); - rdma_restrack_kadd(&mr->res); + rdma_restrack_set_task(&mr->res, pd->res.kern_name); + rdma_restrack_add(&mr->res); out: trace_mr_integ_alloc(pd, max_num_data_sg, max_num_meta_sg, mr); return mr; |