--- nv-linux.h.orig 2018-05-01 01:27:43.540870640 +0200 +++ nv-linux.h 2018-05-01 01:29:43.441476626 +0200 @@ -2081,31 +2081,26 @@ #endif } -/* get_user_pages_remote() was added by: - * 2016 Feb 12: 1e9877902dc7e11d2be038371c6fbf2dfcd469d7 +/* get_user_pages * - * The very next commit (cde70140fed8429acf7a14e2e2cbd3e329036653) - * deprecated the 8-argument version of get_user_pages for the - * non-remote case (calling get_user_pages with current and current->mm). - * - * The guidelines are: call NV_GET_USER_PAGES_REMOTE if you need the 8-argument - * version that uses something other than current and current->mm. Use - * NV_GET_USER_PAGES if you are refering to current and current->mm. - * - * Note that get_user_pages_remote() requires the caller to hold a reference on - * the task_struct (if non-NULL) and the mm_struct. This will always be true - * when using current and current->mm. If the kernel passes the driver a vma - * via driver callback, the kernel holds a reference on vma->vm_mm over that - * callback. + * The 8-argument version of get_user_pages was deprecated by commit + * (2016 Feb 12: cde70140fed8429acf7a14e2e2cbd3e329036653)for the non-remote case + * (calling get_user_pages with current and current->mm). + * + * Completely moved to the 6 argument version of get_user_pages - + * 2016 Apr 4: c12d2da56d0e07d230968ee2305aaa86b93a6832 + * + * write and force parameters were replaced with gup_flags by - + * 2016 Oct 12: 768ae309a96103ed02eb1e111e838c87854d8b51 * - * get_user_pages_remote() added 'locked' parameter - * 2016 Dec 14:5b56d49fc31dbb0487e14ead790fc81ca9fb2c99 */ -#if defined(NV_GET_USER_PAGES_REMOTE_PRESENT) +#if defined(NV_GET_USER_PAGES_HAS_TASK_STRUCT) + #define NV_GET_USER_PAGES(start, nr_pages, write, force, pages, vmas) \ + get_user_pages(current, current->mm, start, nr_pages, write, force, pages, vmas) +#else #if defined(NV_GET_USER_PAGES_HAS_WRITE_AND_FORCE_ARGS) - #define NV_GET_USER_PAGES get_user_pages - #define NV_GET_USER_PAGES_REMOTE get_user_pages_remote + #define NV_GET_USER_PAGES get_user_pages #else #include @@ -2115,7 +2110,7 @@ int force, struct page **pages, struct vm_area_struct **vmas) - { +{ unsigned int flags = 0; if (write) @@ -2124,8 +2119,35 @@ flags |= FOLL_FORCE; return get_user_pages(start, nr_pages, flags, pages, vmas); - } +} + #endif +#endif +/* get_user_pages_remote() was added by: + * 2016 Feb 12: 1e9877902dc7e11d2be038371c6fbf2dfcd469d7 + * + * The very next commit (cde70140fed8429acf7a14e2e2cbd3e329036653) + * deprecated the 8-argument version of get_user_pages for the + * non-remote case (calling get_user_pages with current and current->mm). + * + * The guidelines are: call NV_GET_USER_PAGES_REMOTE if you need the 8-argument + * version that uses something other than current and current->mm. Use + * NV_GET_USER_PAGES if you are refering to current and current->mm. + * + * Note that get_user_pages_remote() requires the caller to hold a reference on + * the task_struct (if non-NULL) and the mm_struct. This will always be true + * when using current and current->mm. If the kernel passes the driver a vma + * via driver callback, the kernel holds a reference on vma->vm_mm over that + * callback. + * + * get_user_pages_remote() added 'locked' parameter + * 2016 Dec 14:5b56d49fc31dbb0487e14ead790fc81ca9fb2c99 + */ + +#if defined(NV_GET_USER_PAGES_REMOTE_PRESENT) + #if defined(NV_GET_USER_PAGES_REMOTE_HAS_WRITE_AND_FORCE_ARGS) + #define NV_GET_USER_PAGES_REMOTE get_user_pages_remote + #else static inline long NV_GET_USER_PAGES_REMOTE(struct task_struct *tsk, struct mm_struct *mm, unsigned long start, @@ -2134,7 +2156,7 @@ int force, struct page **pages, struct vm_area_struct **vmas) - { +{ unsigned int flags = 0; if (write) @@ -2154,13 +2176,10 @@ #endif - } +} #endif #else - #define NV_GET_USER_PAGES(start, nr_pages, write, force, pages, vmas) \ - get_user_pages(current, current->mm, start, nr_pages, write, force, pages, vmas) - - #define NV_GET_USER_PAGES_REMOTE get_user_pages + #define NV_GET_USER_PAGES_REMOTE NV_GET_USER_PAGES #endif #endif /* _NV_LINUX_H_ */