Re: [PATCH rdma-next v1 1/6] RDMA/umem: Combine contiguous PAGE_SIZE regions in SGEs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 19, 2019 at 11:41:56AM -0800, Ira Weiny wrote:
> On Tue, Feb 19, 2019 at 08:57:40AM -0600, 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.
> > 
> > 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;
> >
> 
> NIT: Did anything change here?

I removed the horizonatl alignments as it was not consistent
on all struct members.

> 
> >  	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;
> 
> 
> Why can't we use sg_head.nents instead of tracking this in umem?
>

This is because we start off by overallocating the sg table off total system
pages in the umem. But when we iterate the page list after pinning and combine pages
into the SGEs, the scatterlist can turn out to be much smaller, i.e. umem->sg_nents
< umem->sg_head.nents. We remark the new end of the scatterlist and DMA map with umem->sg_nents.

Ideally, we should not be overllocating the sg table and this is part of future work.

Shiraz
 
> FWIW I don't see where sg_table.nents is used anywhere...  That is odd to me.
>
 



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux