On Wed, Apr 03, 2019 at 08:51:22PM +0300, Leon Romanovsky wrote: > On Wed, Apr 03, 2019 at 02:38:35PM -0300, Jason Gunthorpe wrote: > > On Wed, Apr 03, 2019 at 08:15:14PM +0300, Leon Romanovsky wrote: > > > > @@ -203,28 +263,29 @@ struct ib_umem *ib_umem_get(struct ib_udata *udata, unsigned long addr, > > > > goto umem_release; > > > > } > > > > > > > > - umem->npages += ret; > > > > cur_base += ret * PAGE_SIZE; > > > > npages -= ret; > > > > > > > > + sg = ib_umem_add_sg_table(sg, page_list, ret, > > > > + dma_get_max_seg_size(context->device->dma_device), > > > > + &umem->sg_nents); > > > > + > > > > /* Continue to hold the mmap_sem as vma_list access > > > > * needs to be protected. > > > > */ > > > > - for_each_sg(sg_list_start, sg, ret, i) { > > > > + for (i = 0; i < ret && umem->hugetlb; i++) { > > > > if (vma_list && !is_vm_hugetlb_page(vma_list[i])) > > > > umem->hugetlb = 0; > > > > - > > > > - sg_set_page(sg, page_list[i], PAGE_SIZE, 0); > > > > } > > > > > > I was under wrong impression that we removed hugetlb flag. Is it still needed? > > > And more general question, how was 2G limit chosen? > > > > The next patches do that - it can't be done until the two drivers > > using it convert to this new interface. > > > > This specific patch is just the only patch in the process that impacts > > every driver, and is what all the work thus far has been to make safe. > > > > Once this is applied it will be easy to apply the next ones as they > > only impact two drivers and other drivers can debug and use the new > > features as they need. > > Thanks for the explanation, and what about 2G limit? The sgl->sg_len is an unsigned int so the largest power of two we can store in it is 2G. Jason