[openib-general] [PATCH 07/13] [RFC] ipath core misc files

Krishna Kumar2 krkumar2 at in.ibm.com
Mon Dec 19 02:46:40 PST 2005


Roland Dreier <rolandd at cisco.com> wrote:

...
> +int ipath_mlock(unsigned long start_page, size_t num_pages, struct page 
**p)
> +{
> +   int n;
> +
> +   _IPATH_VDBG("pin %lx pages from vaddr %lx\n", num_pages, 
start_page);
> +   down_read(&current->mm->mmap_sem);
> +   n = get_user_pages(current, current->mm, start_page, num_pages, 1, 
1,
> +            p, NULL);
> +   up_read(&current->mm->mmap_sem);
> +   if (n != num_pages) {
> +      _IPATH_INFO
> +          ("get_user_pages (0x%lx pages starting at 0x%lx failed with 
%d\n",
> +           num_pages, start_page, n);
> +      if (n < 0)   /* it's an errno */
> +         return n;
> +      return -ENOMEM;   /* no way to know actual error */
> +   }
> +
> +   return 0;
> +}

For this routine (where num_pages can be >1), in the error case you need 
to 
page_cache_release() the pages that were successfully 'got' 
(get_page()'d).

- KK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20051219/bdb403e8/attachment.html>


More information about the general mailing list