On Thu, Feb 28, 2019 at 03:38:55PM +0000, Bernard Metzler wrote: > >> +int siw_mmap(struct ib_ucontext *ctx, struct vm_area_struct *vma) > >> +{ > >> + struct siw_ucontext *uctx = to_siw_ctx(ctx); > >> + struct siw_uobj *uobj; > >> + u32 key = vma->vm_pgoff << PAGE_SHIFT; > >> + int size = vma->vm_end - vma->vm_start; > >> + int rv = -EINVAL; > >> + > >> + /* > >> + * Must be page aligned > >> + */ > >> + if (vma->vm_start & (PAGE_SIZE - 1)) { > >> + pr_warn("map not page aligned\n"); > >> + goto out; > >> + } > >> + > >> + uobj = siw_remove_uobj(uctx, key, size); > >> + if (!uobj) { > >> + pr_warn("mmap lookup failed: %u, %d\n", key, size); > >> + goto out; > >> + } > > > >EFA used to remove the objects from the list on mmap and we were > >asked by Jason > >to keep them in the list until dealloc_ucontext. This way multiple > >mmaps could > >work as well. > > siw user land library currently does not support multiple mappings of > the same object, will consider in the future. We should have sane semantics for mmap and related - don't discard the offset once it is exposed unless really necessary. And this thing with search a list is not great, use a cyclic xarray to generate and find the unique offset cookies. Jason