Re: [PATCH 36/41] IB/hfi1: add low level page locking

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

 



On Fri, Jun 12, 2015 at 2:11 AM, Mike Marciniszyn
<mike.marciniszyn@xxxxxxxxx> wrote:

> +++ b/drivers/infiniband/hw/hfi1/user_pages.c

> +/**
> + * hfi1_get_user_pages - lock user pages into memory
> + * @start_page: the start page
> + * @num_pages: the number of pages
> + * @p: the output page structures
> + *
> + * This function takes a given start page (page aligned user virtual
> + * address) and pins it and the following specified number of pages.  For
> + * now, num_pages is always 1, but that will probably change at some point
> + * (because caller is doing expected sends on a single virtually contiguous
> + * buffer, so we can do all pages at once).
> + */
> +int hfi1_get_user_pages(unsigned long start_page, size_t num_pages,
> +                       struct page **p)
> +{
> +       int ret;
> +
> +       down_write(&current->mm->mmap_sem);
> +
> +       ret = __hfi1_get_user_pages(start_page, num_pages, p);
> +
> +       up_write(&current->mm->mmap_sem);
> +
> +       return ret;
> +}
> +

anything wrong with the umem services provided by the IB core that
requires this implementation? what?

> +void hfi1_release_user_pages(struct page **p, size_t num_pages)
> +{
> +       if (current->mm) /* during close after signal, mm can be NULL */
> +               down_write(&current->mm->mmap_sem);
> +
> +       __hfi1_release_user_pages(p, num_pages, 1);
> +
> +       if (current->mm) {
> +               current->mm->pinned_vm -= num_pages;
> +               up_write(&current->mm->mmap_sem);
> +       }
> +}
>
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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