diff options
author | Jason Gunthorpe <jgg@mellanox.com> | 2019-08-15 11:38:30 +0300 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2019-08-20 20:44:43 +0300 |
commit | 27b7fb1ab7bfad45f5702ff0c78a4822a41b1456 (patch) | |
tree | 4cf696cda214d8fae2e1afb8e5d9d410f0b65ffe /drivers/infiniband/core | |
parent | d1abaeb3be7b5fa6d7a1fbbd2e14e3310005c4c1 (diff) | |
download | linux-27b7fb1ab7bfad45f5702ff0c78a4822a41b1456.tar.xz |
RDMA/mlx5: Fix MR npages calculation for IB_ACCESS_HUGETLB
When ODP is enabled with IB_ACCESS_HUGETLB then the required pages
should be calculated based on the extent of the MR, which is rounded
to the nearest huge page alignment.
Fixes: d2183c6f1958 ("RDMA/umem: Move page_shift from ib_umem to ib_odp_umem")
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Link: https://lore.kernel.org/r/20190815083834.9245-5-leon@kernel.org
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/core')
-rw-r--r-- | drivers/infiniband/core/umem.c | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/drivers/infiniband/core/umem.c b/drivers/infiniband/core/umem.c index 08da840ed7ee..56553668256f 100644 --- a/drivers/infiniband/core/umem.c +++ b/drivers/infiniband/core/umem.c @@ -379,14 +379,9 @@ EXPORT_SYMBOL(ib_umem_release); int ib_umem_page_count(struct ib_umem *umem) { - int i; - int n; + int i, n = 0; struct scatterlist *sg; - if (umem->is_odp) - return ib_umem_num_pages(umem); - - n = 0; for_each_sg(umem->sg_head.sgl, sg, umem->nmap, i) n += sg_dma_len(sg) >> PAGE_SHIFT; |