History

mm/gup.c: convert to use get_user_{page|pages}_fast_only()

API __get_user_pages_fast() renamed to get_user_pages_fast_only() to align with pin_user_pages_fast_only(). As part of this we will get rid of write parameter. Instead caller will pass FOLL_WRITE to get_user_pages_fast_only(). This will not change any existing functionality of the API. All the callers are changed to pass FOLL_WRITE. Also introduce get_user_page_fast_only(), and use it in a few places that hard-code nr_pages to 1. Updated the documentation of the API.

Souptick Joarder committed 6 years ago

Commit dadbb611 parent e77132e7 files · +32 −27Browse files

Showing the changes to include/linux (1 of 7 files). Show all

Unified · Split

include/linux/mm.h+8−2
@@ -1824,10 +1824,16 @@ extern int mprotect_fixup(struct vm_area_struct *vma, · 1823 unmodified lines
18241824 /*
18251825 * doesn't attempt to fault and will return short.
18261826 */
1827−int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
1828− struct page **pages);
1827+int get_user_pages_fast_only(unsigned long start, int nr_pages,
1828+ unsigned int gup_flags, struct page **pages);
18291829 int pin_user_pages_fast_only(unsigned long start, int nr_pages,
18301830 unsigned int gup_flags, struct page **pages);
1831+
1832+static inline bool get_user_page_fast_only(unsigned long addr,
1833+ unsigned int gup_flags, struct page **pagep)
1834+{
1835+ return get_user_pages_fast_only(addr, 1, gup_flags, pagep) == 1;
1836+}
18311837 /*
18321838 * per-process(per-mm_struct) statistics.
18331839 */