Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'mm-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull mm gup cleanup from Ingo Molnar:
"This removes the ugly get-user-pages API hack, now that all upstream
code has been migrated to it"

("ugly" is putting it mildly. But it worked.. - Linus)

* 'mm-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
mm/gup: Remove the macro overload API migration helpers from the get_user*() APIs

+17 -143
+3 -61
include/linux/mm.h
··· 1250 1250 unsigned long start, unsigned long nr_pages, 1251 1251 int write, int force, struct page **pages, 1252 1252 struct vm_area_struct **vmas); 1253 - long get_user_pages6(unsigned long start, unsigned long nr_pages, 1253 + long get_user_pages(unsigned long start, unsigned long nr_pages, 1254 1254 int write, int force, struct page **pages, 1255 1255 struct vm_area_struct **vmas); 1256 - long get_user_pages_locked6(unsigned long start, unsigned long nr_pages, 1256 + long get_user_pages_locked(unsigned long start, unsigned long nr_pages, 1257 1257 int write, int force, struct page **pages, int *locked); 1258 1258 long __get_user_pages_unlocked(struct task_struct *tsk, struct mm_struct *mm, 1259 1259 unsigned long start, unsigned long nr_pages, 1260 1260 int write, int force, struct page **pages, 1261 1261 unsigned int gup_flags); 1262 - long get_user_pages_unlocked5(unsigned long start, unsigned long nr_pages, 1262 + long get_user_pages_unlocked(unsigned long start, unsigned long nr_pages, 1263 1263 int write, int force, struct page **pages); 1264 1264 int get_user_pages_fast(unsigned long start, int nr_pages, int write, 1265 1265 struct page **pages); 1266 - 1267 - /* suppress warnings from use in EXPORT_SYMBOL() */ 1268 - #ifndef __DISABLE_GUP_DEPRECATED 1269 - #define __gup_deprecated __deprecated 1270 - #else 1271 - #define __gup_deprecated 1272 - #endif 1273 - /* 1274 - * These macros provide backward-compatibility with the old 1275 - * get_user_pages() variants which took tsk/mm. These 1276 - * functions/macros provide both compile-time __deprecated so we 1277 - * can catch old-style use and not break the build. The actual 1278 - * functions also have WARN_ON()s to let us know at runtime if 1279 - * the get_user_pages() should have been the "remote" variant. 1280 - * 1281 - * These are hideous, but temporary. 1282 - * 1283 - * If you run into one of these __deprecated warnings, look 1284 - * at how you are calling get_user_pages(). If you are calling 1285 - * it with current/current->mm as the first two arguments, 1286 - * simply remove those arguments. The behavior will be the same 1287 - * as it is now. If you are calling it on another task, use 1288 - * get_user_pages_remote() instead. 1289 - * 1290 - * Any questions? Ask Dave Hansen <dave@sr71.net> 1291 - */ 1292 - long 1293 - __gup_deprecated 1294 - get_user_pages8(struct task_struct *tsk, struct mm_struct *mm, 1295 - unsigned long start, unsigned long nr_pages, 1296 - int write, int force, struct page **pages, 1297 - struct vm_area_struct **vmas); 1298 - #define GUP_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, get_user_pages, ...) \ 1299 - get_user_pages 1300 - #define get_user_pages(...) GUP_MACRO(__VA_ARGS__, \ 1301 - get_user_pages8, x, \ 1302 - get_user_pages6, x, x, x, x, x)(__VA_ARGS__) 1303 - 1304 - __gup_deprecated 1305 - long get_user_pages_locked8(struct task_struct *tsk, struct mm_struct *mm, 1306 - unsigned long start, unsigned long nr_pages, 1307 - int write, int force, struct page **pages, 1308 - int *locked); 1309 - #define GUPL_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, get_user_pages_locked, ...) \ 1310 - get_user_pages_locked 1311 - #define get_user_pages_locked(...) GUPL_MACRO(__VA_ARGS__, \ 1312 - get_user_pages_locked8, x, \ 1313 - get_user_pages_locked6, x, x, x, x)(__VA_ARGS__) 1314 - 1315 - __gup_deprecated 1316 - long get_user_pages_unlocked7(struct task_struct *tsk, struct mm_struct *mm, 1317 - unsigned long start, unsigned long nr_pages, 1318 - int write, int force, struct page **pages); 1319 - #define GUPU_MACRO(_1, _2, _3, _4, _5, _6, _7, get_user_pages_unlocked, ...) \ 1320 - get_user_pages_unlocked 1321 - #define get_user_pages_unlocked(...) GUPU_MACRO(__VA_ARGS__, \ 1322 - get_user_pages_unlocked7, x, \ 1323 - get_user_pages_unlocked5, x, x, x, x)(__VA_ARGS__) 1324 1266 1325 1267 /* Container for pinned pfns / pages */ 1326 1268 struct frame_vector {
+7 -45
mm/gup.c
··· 1 - #define __DISABLE_GUP_DEPRECATED 1 2 1 #include <linux/kernel.h> 3 2 #include <linux/errno.h> 4 3 #include <linux/err.h> ··· 838 839 * if (locked) 839 840 * up_read(&mm->mmap_sem); 840 841 */ 841 - long get_user_pages_locked6(unsigned long start, unsigned long nr_pages, 842 + long get_user_pages_locked(unsigned long start, unsigned long nr_pages, 842 843 int write, int force, struct page **pages, 843 844 int *locked) 844 845 { ··· 846 847 write, force, pages, NULL, locked, true, 847 848 FOLL_TOUCH); 848 849 } 849 - EXPORT_SYMBOL(get_user_pages_locked6); 850 + EXPORT_SYMBOL(get_user_pages_locked); 850 851 851 852 /* 852 853 * Same as get_user_pages_unlocked(...., FOLL_TOUCH) but it allows to ··· 891 892 * or if "force" shall be set to 1 (get_user_pages_fast misses the 892 893 * "force" parameter). 893 894 */ 894 - long get_user_pages_unlocked5(unsigned long start, unsigned long nr_pages, 895 + long get_user_pages_unlocked(unsigned long start, unsigned long nr_pages, 895 896 int write, int force, struct page **pages) 896 897 { 897 898 return __get_user_pages_unlocked(current, current->mm, start, nr_pages, 898 899 write, force, pages, FOLL_TOUCH); 899 900 } 900 - EXPORT_SYMBOL(get_user_pages_unlocked5); 901 + EXPORT_SYMBOL(get_user_pages_unlocked); 901 902 902 903 /* 903 904 * get_user_pages_remote() - pin user pages in memory ··· 971 972 * and mm being operated on are the current task's. We also 972 973 * obviously don't pass FOLL_REMOTE in here. 973 974 */ 974 - long get_user_pages6(unsigned long start, unsigned long nr_pages, 975 + long get_user_pages(unsigned long start, unsigned long nr_pages, 975 976 int write, int force, struct page **pages, 976 977 struct vm_area_struct **vmas) 977 978 { ··· 979 980 write, force, pages, vmas, NULL, false, 980 981 FOLL_TOUCH); 981 982 } 982 - EXPORT_SYMBOL(get_user_pages6); 983 + EXPORT_SYMBOL(get_user_pages); 983 984 984 985 /** 985 986 * populate_vma_page_range() - populate a range of pages in the vma. ··· 1490 1491 int get_user_pages_fast(unsigned long start, int nr_pages, int write, 1491 1492 struct page **pages) 1492 1493 { 1493 - struct mm_struct *mm = current->mm; 1494 1494 int nr, ret; 1495 1495 1496 1496 start &= PAGE_MASK; ··· 1501 1503 start += nr << PAGE_SHIFT; 1502 1504 pages += nr; 1503 1505 1504 - ret = get_user_pages_unlocked(current, mm, start, 1505 - nr_pages - nr, write, 0, pages); 1506 + ret = get_user_pages_unlocked(start, nr_pages - nr, write, 0, pages); 1506 1507 1507 1508 /* Have to be a bit careful with return values */ 1508 1509 if (nr > 0) { ··· 1516 1519 } 1517 1520 1518 1521 #endif /* CONFIG_HAVE_GENERIC_RCU_GUP */ 1519 - 1520 - long get_user_pages8(struct task_struct *tsk, struct mm_struct *mm, 1521 - unsigned long start, unsigned long nr_pages, 1522 - int write, int force, struct page **pages, 1523 - struct vm_area_struct **vmas) 1524 - { 1525 - WARN_ONCE(tsk != current, "get_user_pages() called on remote task"); 1526 - WARN_ONCE(mm != current->mm, "get_user_pages() called on remote mm"); 1527 - 1528 - return get_user_pages6(start, nr_pages, write, force, pages, vmas); 1529 - } 1530 - EXPORT_SYMBOL(get_user_pages8); 1531 - 1532 - long get_user_pages_locked8(struct task_struct *tsk, struct mm_struct *mm, 1533 - unsigned long start, unsigned long nr_pages, 1534 - int write, int force, struct page **pages, int *locked) 1535 - { 1536 - WARN_ONCE(tsk != current, "get_user_pages_locked() called on remote task"); 1537 - WARN_ONCE(mm != current->mm, "get_user_pages_locked() called on remote mm"); 1538 - 1539 - return get_user_pages_locked6(start, nr_pages, write, force, pages, locked); 1540 - } 1541 - EXPORT_SYMBOL(get_user_pages_locked8); 1542 - 1543 - long get_user_pages_unlocked7(struct task_struct *tsk, struct mm_struct *mm, 1544 - unsigned long start, unsigned long nr_pages, 1545 - int write, int force, struct page **pages) 1546 - { 1547 - WARN_ONCE(tsk != current, "get_user_pages_unlocked() called on remote task"); 1548 - WARN_ONCE(mm != current->mm, "get_user_pages_unlocked() called on remote mm"); 1549 - 1550 - return get_user_pages_unlocked5(start, nr_pages, write, force, pages); 1551 - } 1552 - EXPORT_SYMBOL(get_user_pages_unlocked7); 1553 -
+7 -37
mm/nommu.c
··· 15 15 16 16 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 17 17 18 - #define __DISABLE_GUP_DEPRECATED 19 - 20 18 #include <linux/export.h> 21 19 #include <linux/mm.h> 22 20 #include <linux/vmacache.h> ··· 159 161 * slab page or a secondary page from a compound page 160 162 * - don't permit access to VMAs that don't support it, such as I/O mappings 161 163 */ 162 - long get_user_pages6(unsigned long start, unsigned long nr_pages, 164 + long get_user_pages(unsigned long start, unsigned long nr_pages, 163 165 int write, int force, struct page **pages, 164 166 struct vm_area_struct **vmas) 165 167 { ··· 173 175 return __get_user_pages(current, current->mm, start, nr_pages, flags, 174 176 pages, vmas, NULL); 175 177 } 176 - EXPORT_SYMBOL(get_user_pages6); 178 + EXPORT_SYMBOL(get_user_pages); 177 179 178 - long get_user_pages_locked6(unsigned long start, unsigned long nr_pages, 180 + long get_user_pages_locked(unsigned long start, unsigned long nr_pages, 179 181 int write, int force, struct page **pages, 180 182 int *locked) 181 183 { 182 - return get_user_pages6(start, nr_pages, write, force, pages, NULL); 184 + return get_user_pages(start, nr_pages, write, force, pages, NULL); 183 185 } 184 - EXPORT_SYMBOL(get_user_pages_locked6); 186 + EXPORT_SYMBOL(get_user_pages_locked); 185 187 186 188 long __get_user_pages_unlocked(struct task_struct *tsk, struct mm_struct *mm, 187 189 unsigned long start, unsigned long nr_pages, ··· 197 199 } 198 200 EXPORT_SYMBOL(__get_user_pages_unlocked); 199 201 200 - long get_user_pages_unlocked5(unsigned long start, unsigned long nr_pages, 202 + long get_user_pages_unlocked(unsigned long start, unsigned long nr_pages, 201 203 int write, int force, struct page **pages) 202 204 { 203 205 return __get_user_pages_unlocked(current, current->mm, start, nr_pages, 204 206 write, force, pages, 0); 205 207 } 206 - EXPORT_SYMBOL(get_user_pages_unlocked5); 208 + EXPORT_SYMBOL(get_user_pages_unlocked); 207 209 208 210 /** 209 211 * follow_pfn - look up PFN at a user virtual address ··· 1987 1989 return 0; 1988 1990 } 1989 1991 subsys_initcall(init_admin_reserve); 1990 - 1991 - long get_user_pages8(struct task_struct *tsk, struct mm_struct *mm, 1992 - unsigned long start, unsigned long nr_pages, 1993 - int write, int force, struct page **pages, 1994 - struct vm_area_struct **vmas) 1995 - { 1996 - return get_user_pages6(start, nr_pages, write, force, pages, vmas); 1997 - } 1998 - EXPORT_SYMBOL(get_user_pages8); 1999 - 2000 - long get_user_pages_locked8(struct task_struct *tsk, struct mm_struct *mm, 2001 - unsigned long start, unsigned long nr_pages, 2002 - int write, int force, struct page **pages, 2003 - int *locked) 2004 - { 2005 - return get_user_pages_locked6(start, nr_pages, write, 2006 - force, pages, locked); 2007 - } 2008 - EXPORT_SYMBOL(get_user_pages_locked8); 2009 - 2010 - long get_user_pages_unlocked7(struct task_struct *tsk, struct mm_struct *mm, 2011 - unsigned long start, unsigned long nr_pages, 2012 - int write, int force, struct page **pages) 2013 - { 2014 - return get_user_pages_unlocked5(start, nr_pages, write, force, pages); 2015 - } 2016 - EXPORT_SYMBOL(get_user_pages_unlocked7); 2017 -