Memory Management API: get_user_pages_fast,

Source: Internet
Author: User

Memory Management API: get_user_pages_fast,

Memory Management API: get_user_pages_fast

Int get_user_pages_fast (unsigned long start, int nr_pages, int write, struct page ** pages) and get_user_pages have the same effect. source code analysis: int get_user_pages_fast (unsigned long start, int nr_pages, int write, struct page ** pages) {unsigned long addr, len, end; int nr = 0, ret = 0; # the actual address needs to be mapped. The page size must be aligned with start & = PAGE_MASK; addr = start; # The length of the map len = (unsigned long) nr_pages <PAGE_SHIFT; end = start + len; # If this address cannot be read/written, If (unlikely (! Access_ OK (write? VERIFY_WRITE: VERIFY_READ, (void _ user *) start, len) return 0; if (gup_fast_permitted (start, nr_pages, write) {local_irq_disable (); gup_pgd_range (addr, end, write, pages, & nr); local_irq_enable (); ret = nr;} if (nr <nr_pages) {/* Try to get the remaining pages with get_user_pages */start + = nr <PAGE_SHIFT; pages + = nr; # get_user_pages_unlocked->__ rows->__ get_user_pages_locked to map, Before _ get_user_pages_locked is mapped to this function # ret = get_user_pages_unlocked (start, nr_pages-nr, pages, write? FOLL_WRITE: 0);/* Have to be a bit careful with return values */if (nr> 0) {if (ret <0) ret = nr; elseret + = nr;} return ret ;}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.