>Subject: Re: [PATCH v2 rdma-next] RDMA/umem: Combine contiguous >PAGE_SIZE regions in SGEs > >On Mon, Mar 18, 2019 at 08:59:48AM -0500, Shiraz Saleem wrote: >> Combine contiguous regions of PAGE_SIZE pages into single scatter list >> entries while adding to the scatter table. This minimizes the number >> of the entries in the scatter list and reduces the DMA mapping >> overhead, particularly with the IOMMU. >> >> This patch should be applied post >> https://patchwork.kernel.org/cover/10857607/ >> >> Suggested-by: Jason Gunthorpe <jgg@xxxxxxxx> >> Reviewed-by: Michael J. Ruhl <michael.j.ruhl@xxxxxxxxx> >> Signed-off-by: Shiraz Saleem <shiraz.saleem@xxxxxxxxx> >> --- [...] >> diff --git a/include/rdma/ib_umem.h b/include/rdma/ib_umem.h index >> 73af05d..18407a4 100644 >> --- a/include/rdma/ib_umem.h >> +++ b/include/rdma/ib_umem.h >> @@ -42,18 +42,19 @@ >> struct ib_umem_odp; >> >> struct ib_umem { >> - struct ib_ucontext *context; >> - struct mm_struct *owning_mm; >> - size_t length; >> - unsigned long address; >> - int page_shift; >> + struct ib_ucontext *context; >> + struct mm_struct *owning_mm; >> + size_t length; >> + unsigned long address; >> + int page_shift; >> u32 writable : 1; >> u32 hugetlb : 1; >> u32 is_odp : 1; >> - struct work_struct work; >> + struct work_struct work; >> struct sg_table sg_head; >> - int nmap; >> - int npages; >> + int sg_nents; >> + int nmap; >> + int npages; > >I feel like I've asked this before and you had a good answer. So forgive me... > >Why can't we use umem->sg_head.nents for umem->sg_nents ? Hi Ira - This is because we size the sg table off the total system pages in umem. But with page combining, the scatterlist can be smaller, ie. umem->sg_nents < umem->sg_head.nents. We mark the new end of the scatterlist after page combining and DMA map with umem->sg_nents. Ideally, we want to not over-allocate the sg table and this is part of future work. > >Assuming I've just forgotten something stupid... > >Reviewed-by: Ira Weiny <ira.weiny@xxxxxxxxx> > >Ira > >> }; >> >> /* Returns the offset of the umem start relative to the first page. >> */ >> -- >> 1.8.3.1 >>