From: Gal Pressman <galpress@amazon.com>
To: Jason Gunthorpe <jgg@ziepe.ca>, Doug Ledford <dledford@redhat.com>
Cc: <linux-rdma@vger.kernel.org>,
Alexander Matushevsky <matua@amazon.com>,
Gal Pressman <galpress@amazon.com>,
Firas JahJah <firasj@amazon.com>,
"Yossi Leybovich" <sleybo@amazon.com>
Subject: [PATCH for-next 6/6] RDMA/efa: Do not delay freeing of DMA pages
Date: Tue, 14 Jan 2020 10:57:06 +0200 [thread overview]
Message-ID: <20200114085706.82229-7-galpress@amazon.com> (raw)
In-Reply-To: <20200114085706.82229-1-galpress@amazon.com>
When destroying a DMA mmapped object, there is no need to delay the
pages freeing to dealloc_ucontext as the kernel itself will keep
reference count for these pages.
Remove the special handling of DMA pages and call free_pages_exact on
destroy_qp/cq.
Reviewed-by: Firas JahJah <firasj@amazon.com>
Reviewed-by: Yossi Leybovich <sleybo@amazon.com>
Signed-off-by: Gal Pressman <galpress@amazon.com>
---
drivers/infiniband/hw/efa/efa_verbs.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/drivers/infiniband/hw/efa/efa_verbs.c b/drivers/infiniband/hw/efa/efa_verbs.c
index 9a6cff718c49..fd2fc60d569f 100644
--- a/drivers/infiniband/hw/efa/efa_verbs.c
+++ b/drivers/infiniband/hw/efa/efa_verbs.c
@@ -413,6 +413,7 @@ int efa_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata)
&qp->rq_dma_addr);
dma_unmap_single(&dev->pdev->dev, qp->rq_dma_addr, qp->rq_size,
DMA_TO_DEVICE);
+ free_pages_exact(qp->rq_cpu_addr, qp->rq_size);
}
efa_qp_user_mmap_entries_remove(qp);
@@ -723,9 +724,7 @@ struct ib_qp *efa_create_qp(struct ib_pd *ibpd,
if (qp->rq_size) {
dma_unmap_single(&dev->pdev->dev, qp->rq_dma_addr, qp->rq_size,
DMA_TO_DEVICE);
-
- if (!qp->rq_mmap_entry)
- free_pages_exact(qp->rq_cpu_addr, qp->rq_size);
+ free_pages_exact(qp->rq_cpu_addr, qp->rq_size);
}
err_free_qp:
kfree(qp);
@@ -848,6 +847,7 @@ void efa_destroy_cq(struct ib_cq *ibcq, struct ib_udata *udata)
efa_destroy_cq_idx(dev, cq->cq_idx);
dma_unmap_single(&dev->pdev->dev, cq->dma_addr, cq->size,
DMA_FROM_DEVICE);
+ free_pages_exact(cq->cpu_addr, cq->size);
rdma_user_mmap_entry_remove(cq->mmap_entry);
}
@@ -987,8 +987,7 @@ int efa_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
err_free_mapped:
dma_unmap_single(&dev->pdev->dev, cq->dma_addr, cq->size,
DMA_FROM_DEVICE);
- if (!cq->mmap_entry)
- free_pages_exact(cq->cpu_addr, cq->size);
+ free_pages_exact(cq->cpu_addr, cq->size);
err_out:
atomic64_inc(&dev->stats.sw_stats.create_cq_err);
@@ -1549,10 +1548,6 @@ void efa_mmap_free(struct rdma_user_mmap_entry *rdma_entry)
{
struct efa_user_mmap_entry *entry = to_emmap(rdma_entry);
- /* DMA mapping is already gone, now free the pages */
- if (entry->mmap_flag == EFA_MMAP_DMA_PAGE)
- free_pages_exact(phys_to_virt(entry->address),
- entry->rdma_entry.npages * PAGE_SIZE);
kfree(entry);
}
--
2.24.1
next prev parent reply other threads:[~2020-01-14 8:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-14 8:57 [PATCH for-next 0/6] EFA updates 2020-01-14 Gal Pressman
2020-01-14 8:57 ` [PATCH for-next 1/6] RDMA/efa: Unified getters/setters for device structs bitmask access Gal Pressman
2020-01-15 19:31 ` Jason Gunthorpe
2020-01-16 7:05 ` Gal Pressman
2020-01-14 8:57 ` [PATCH for-next 2/6] RDMA/efa: Properly document the interrupt mask register Gal Pressman
2020-01-14 8:57 ` [PATCH for-next 3/6] RDMA/efa: Device definitions documentation updates Gal Pressman
2020-01-14 8:57 ` [PATCH for-next 4/6] RDMA/efa: Remove {} brackets from single statement if Gal Pressman
2020-01-14 8:57 ` [PATCH for-next 5/6] RDMA/efa: Remove unused ucontext parameter from efa_qp_user_mmap_entries_remove Gal Pressman
2020-01-14 8:57 ` Gal Pressman [this message]
2020-01-15 19:51 ` [PATCH for-next 6/6] RDMA/efa: Do not delay freeing of DMA pages Jason Gunthorpe
2020-01-16 8:26 ` Gal Pressman
2020-01-15 19:58 ` [PATCH for-next 0/6] EFA updates 2020-01-14 Jason Gunthorpe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200114085706.82229-7-galpress@amazon.com \
--to=galpress@amazon.com \
--cc=dledford@redhat.com \
--cc=firasj@amazon.com \
--cc=jgg@ziepe.ca \
--cc=linux-rdma@vger.kernel.org \
--cc=matua@amazon.com \
--cc=sleybo@amazon.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).