gup.c (08d99b2c23dfa84ca5b5e5c194062a0550888b71) | gup.c (72ef5e52b3f74c0be47b20f5c434b7ecc830cf40) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2#include <linux/kernel.h> 3#include <linux/errno.h> 4#include <linux/err.h> 5#include <linux/spinlock.h> 6 7#include <linux/mm.h> 8#include <linux/memremap.h> --- 2829 unchanged lines hidden (view full) --- 2838 * @pages: array that receives pointers to the pages pinned. 2839 * Should be at least nr_pages long. 2840 * 2841 * Nearly the same as get_user_pages_fast(), except that FOLL_PIN is set. See 2842 * get_user_pages_fast() for documentation on the function arguments, because 2843 * the arguments here are identical. 2844 * 2845 * FOLL_PIN means that the pages must be released via unpin_user_page(). Please | 1// SPDX-License-Identifier: GPL-2.0-only 2#include <linux/kernel.h> 3#include <linux/errno.h> 4#include <linux/err.h> 5#include <linux/spinlock.h> 6 7#include <linux/mm.h> 8#include <linux/memremap.h> --- 2829 unchanged lines hidden (view full) --- 2838 * @pages: array that receives pointers to the pages pinned. 2839 * Should be at least nr_pages long. 2840 * 2841 * Nearly the same as get_user_pages_fast(), except that FOLL_PIN is set. See 2842 * get_user_pages_fast() for documentation on the function arguments, because 2843 * the arguments here are identical. 2844 * 2845 * FOLL_PIN means that the pages must be released via unpin_user_page(). Please |
2846 * see Documentation/vm/pin_user_pages.rst for further details. | 2846 * see Documentation/core-api/pin_user_pages.rst for further details. |
2847 * | 2847 * |
2848 * This is intended for Case 1 (DIO) in Documentation/vm/pin_user_pages.rst. It | 2848 * This is intended for Case 1 (DIO) in Documentation/core-api/pin_user_pages.rst. It |
2849 * is NOT intended for Case 2 (RDMA: long-term pins). 2850 */ 2851int pin_user_pages_fast(unsigned long start, int nr_pages, 2852 unsigned int gup_flags, struct page **pages) 2853{ 2854 /* FOLL_GET and FOLL_PIN are mutually exclusive. */ 2855 if (WARN_ON_ONCE(gup_flags & FOLL_GET)) 2856 return -EINVAL; --- 21 unchanged lines hidden (view full) --- 2878 * subsequently whether VM_FAULT_RETRY functionality can be 2879 * utilised. Lock must initially be held. 2880 * 2881 * Nearly the same as get_user_pages_remote(), except that FOLL_PIN is set. See 2882 * get_user_pages_remote() for documentation on the function arguments, because 2883 * the arguments here are identical. 2884 * 2885 * FOLL_PIN means that the pages must be released via unpin_user_page(). Please | 2849 * is NOT intended for Case 2 (RDMA: long-term pins). 2850 */ 2851int pin_user_pages_fast(unsigned long start, int nr_pages, 2852 unsigned int gup_flags, struct page **pages) 2853{ 2854 /* FOLL_GET and FOLL_PIN are mutually exclusive. */ 2855 if (WARN_ON_ONCE(gup_flags & FOLL_GET)) 2856 return -EINVAL; --- 21 unchanged lines hidden (view full) --- 2878 * subsequently whether VM_FAULT_RETRY functionality can be 2879 * utilised. Lock must initially be held. 2880 * 2881 * Nearly the same as get_user_pages_remote(), except that FOLL_PIN is set. See 2882 * get_user_pages_remote() for documentation on the function arguments, because 2883 * the arguments here are identical. 2884 * 2885 * FOLL_PIN means that the pages must be released via unpin_user_page(). Please |
2886 * see Documentation/vm/pin_user_pages.rst for details. | 2886 * see Documentation/core-api/pin_user_pages.rst for details. |
2887 * | 2887 * |
2888 * This is intended for Case 1 (DIO) in Documentation/vm/pin_user_pages.rst. It | 2888 * This is intended for Case 1 (DIO) in Documentation/core-api/pin_user_pages.rst. It |
2889 * is NOT intended for Case 2 (RDMA: long-term pins). 2890 */ 2891long pin_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm, 2892 unsigned long start, unsigned long nr_pages, 2893 unsigned int gup_flags, struct page **pages, 2894 struct vm_area_struct **vmas, int *locked) 2895{ 2896 /* FOLL_GET and FOLL_PIN are mutually exclusive. */ --- 17 unchanged lines hidden (view full) --- 2914 * only intends to ensure the pages are faulted in. 2915 * @vmas: array of pointers to vmas corresponding to each page. 2916 * Or NULL if the caller does not require them. 2917 * 2918 * Nearly the same as get_user_pages(), except that FOLL_TOUCH is not set, and 2919 * FOLL_PIN is set. 2920 * 2921 * FOLL_PIN means that the pages must be released via unpin_user_page(). Please | 2889 * is NOT intended for Case 2 (RDMA: long-term pins). 2890 */ 2891long pin_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm, 2892 unsigned long start, unsigned long nr_pages, 2893 unsigned int gup_flags, struct page **pages, 2894 struct vm_area_struct **vmas, int *locked) 2895{ 2896 /* FOLL_GET and FOLL_PIN are mutually exclusive. */ --- 17 unchanged lines hidden (view full) --- 2914 * only intends to ensure the pages are faulted in. 2915 * @vmas: array of pointers to vmas corresponding to each page. 2916 * Or NULL if the caller does not require them. 2917 * 2918 * Nearly the same as get_user_pages(), except that FOLL_TOUCH is not set, and 2919 * FOLL_PIN is set. 2920 * 2921 * FOLL_PIN means that the pages must be released via unpin_user_page(). Please |
2922 * see Documentation/vm/pin_user_pages.rst for details. | 2922 * see Documentation/core-api/pin_user_pages.rst for details. |
2923 * | 2923 * |
2924 * This is intended for Case 1 (DIO) in Documentation/vm/pin_user_pages.rst. It | 2924 * This is intended for Case 1 (DIO) in Documentation/core-api/pin_user_pages.rst. It |
2925 * is NOT intended for Case 2 (RDMA: long-term pins). 2926 */ 2927long pin_user_pages(unsigned long start, unsigned long nr_pages, 2928 unsigned int gup_flags, struct page **pages, 2929 struct vm_area_struct **vmas) 2930{ 2931 /* FOLL_GET and FOLL_PIN are mutually exclusive. */ 2932 if (WARN_ON_ONCE(gup_flags & FOLL_GET)) 2933 return -EINVAL; 2934 2935 gup_flags |= FOLL_PIN; 2936 return __gup_longterm_locked(current, current->mm, start, nr_pages, 2937 pages, vmas, gup_flags); 2938} 2939EXPORT_SYMBOL(pin_user_pages); | 2925 * is NOT intended for Case 2 (RDMA: long-term pins). 2926 */ 2927long pin_user_pages(unsigned long start, unsigned long nr_pages, 2928 unsigned int gup_flags, struct page **pages, 2929 struct vm_area_struct **vmas) 2930{ 2931 /* FOLL_GET and FOLL_PIN are mutually exclusive. */ 2932 if (WARN_ON_ONCE(gup_flags & FOLL_GET)) 2933 return -EINVAL; 2934 2935 gup_flags |= FOLL_PIN; 2936 return __gup_longterm_locked(current, current->mm, start, nr_pages, 2937 pages, vmas, gup_flags); 2938} 2939EXPORT_SYMBOL(pin_user_pages); |