Commit 37824952 authored by Jason Gunthorpe's avatar Jason Gunthorpe

RDMA/odp: Use kvcalloc for the dma_list and page_list

There is no specific need for these to be in the valloc space, let the
system decide automatically how to do the allocation.

Link: https://lore.kernel.org/r/20190819111710.18440-10-leon@kernel.orgSigned-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 204e3e56
...@@ -314,13 +314,13 @@ static inline int ib_init_umem_odp(struct ib_umem_odp *umem_odp, ...@@ -314,13 +314,13 @@ static inline int ib_init_umem_odp(struct ib_umem_odp *umem_odp,
*/ */
umem_odp->interval_tree.last--; umem_odp->interval_tree.last--;
umem_odp->page_list = vzalloc( umem_odp->page_list = kvcalloc(
array_size(sizeof(*umem_odp->page_list), pages)); pages, sizeof(*umem_odp->page_list), GFP_KERNEL);
if (!umem_odp->page_list) if (!umem_odp->page_list)
return -ENOMEM; return -ENOMEM;
umem_odp->dma_list = umem_odp->dma_list = kvcalloc(
vzalloc(array_size(sizeof(*umem_odp->dma_list), pages)); pages, sizeof(*umem_odp->dma_list), GFP_KERNEL);
if (!umem_odp->dma_list) { if (!umem_odp->dma_list) {
ret = -ENOMEM; ret = -ENOMEM;
goto out_page_list; goto out_page_list;
...@@ -354,9 +354,9 @@ static inline int ib_init_umem_odp(struct ib_umem_odp *umem_odp, ...@@ -354,9 +354,9 @@ static inline int ib_init_umem_odp(struct ib_umem_odp *umem_odp,
out_unlock: out_unlock:
mutex_unlock(&ctx->per_mm_list_lock); mutex_unlock(&ctx->per_mm_list_lock);
vfree(umem_odp->dma_list); kvfree(umem_odp->dma_list);
out_page_list: out_page_list:
vfree(umem_odp->page_list); kvfree(umem_odp->page_list);
return ret; return ret;
} }
...@@ -532,8 +532,8 @@ void ib_umem_odp_release(struct ib_umem_odp *umem_odp) ...@@ -532,8 +532,8 @@ void ib_umem_odp_release(struct ib_umem_odp *umem_odp)
ib_umem_odp_unmap_dma_pages(umem_odp, ib_umem_start(umem_odp), ib_umem_odp_unmap_dma_pages(umem_odp, ib_umem_start(umem_odp),
ib_umem_end(umem_odp)); ib_umem_end(umem_odp));
remove_umem_from_per_mm(umem_odp); remove_umem_from_per_mm(umem_odp);
vfree(umem_odp->dma_list); kvfree(umem_odp->dma_list);
vfree(umem_odp->page_list); kvfree(umem_odp->page_list);
} }
put_per_mm(umem_odp); put_per_mm(umem_odp);
mmdrop(umem_odp->umem.owning_mm); mmdrop(umem_odp->umem.owning_mm);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment