Re: [PATCH v5 06/13] SIW application interface

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

 



On Thu, Apr 11, 2019 at 05:03:39PM +0000, Bernard Metzler wrote:
> 
> >To: "Bernard Metzler" <BMT@xxxxxxxxxxxxxx>
> >From: "Jason Gunthorpe" <jgg@xxxxxxxx>
> >Date: 03/06/2019 08:43PM
> >Cc: "Gal Pressman" <galpress@xxxxxxxxxx>, linux-rdma@xxxxxxxxxxxxxxx
> >Subject: Re: [PATCH v5 06/13] SIW application interface
> >
> >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.
> >
> 
> OK, I am in that xarray business for mmap now. Related to
> that, assume a long living user context which over time
> creates and deletes any amount of QP's, SRQ's CQ's etc - stuff
> which has mmap state for its user mmappable queues. If we
> leave all that state alive with the context, we are wasting lots
> of memory and will sometimes also run out of mmap key space.
> So we should destroy those mmap state if an object gets deletes
> right?

Yes, that would be typical

Jason



[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