On Thu, Apr 16, 2020 at 07:41:33PM +0000, Xiong, Jianxin wrote: > > > +void ib_umem_dmabuf_release(struct ib_umem_dmabuf *umem_dmabuf) { > > > + enum dma_data_direction dir; > > > + > > > + dir = umem_dmabuf->umem.writable ? DMA_BIDIRECTIONAL : > > > +DMA_FROM_DEVICE; > > > + > > > + /* > > > + * Only use the original sgt returned from dma_buf_map_attachment(), > > > + * otherwise the scatterlist may be freed twice due to the map caching > > > + * mechanism. > > > + */ > > > + dma_buf_unmap_attachment(umem_dmabuf->attach, umem_dmabuf->sgt, dir); > > > + dma_buf_detach(umem_dmabuf->dmabuf, umem_dmabuf->attach); > > > + dma_buf_put(umem_dmabuf->dmabuf); > > > + mmdrop(umem_dmabuf->umem.owning_mm); > > > + kfree(umem_dmabuf); > > > +} > > > +EXPORT_SYMBOL(ib_umem_dmabuf_release); > > > > Why is this an EXPORT_SYMBOL? > > It is called from ib_umem_release() which is in a different file. export is only required to call outside the current module, which is is not. > > > diff --git a/include/rdma/ib_umem_dmabuf.h > > > b/include/rdma/ib_umem_dmabuf.h new file mode 100644 index > > > 0000000..e82b205 > > > +++ b/include/rdma/ib_umem_dmabuf.h > > > > This should not be a public header > > It's put there to be consistent with similar headers such as "ib_umem_odp.h". Can be changed. ib_umem_odp is needed by drivers, this is not. Jason