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

mm/gup: remove task_struct pointer for all gup code

After the cleanup of page fault accounting, gup does not need to pass
task_struct around any more. Remove that parameter in the whole gup
stack.

Signed-off-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: John Hubbard <jhubbard@nvidia.com>
Link: http://lkml.kernel.org/r/20200707225021.200906-26-peterx@redhat.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Peter Xu and committed by
Linus Torvalds
64019a2e a2beb5f1

+69 -87
+1 -1
arch/arc/kernel/process.c
··· 91 91 goto fail; 92 92 93 93 mmap_read_lock(current->mm); 94 - ret = fixup_user_fault(current, current->mm, (unsigned long) uaddr, 94 + ret = fixup_user_fault(current->mm, (unsigned long) uaddr, 95 95 FAULT_FLAG_WRITE, NULL); 96 96 mmap_read_unlock(current->mm); 97 97
+1 -1
arch/s390/kvm/interrupt.c
··· 2768 2768 struct page *page = NULL; 2769 2769 2770 2770 mmap_read_lock(kvm->mm); 2771 - get_user_pages_remote(NULL, kvm->mm, uaddr, 1, FOLL_WRITE, 2771 + get_user_pages_remote(kvm->mm, uaddr, 1, FOLL_WRITE, 2772 2772 &page, NULL, NULL); 2773 2773 mmap_read_unlock(kvm->mm); 2774 2774 return page;
+1 -1
arch/s390/kvm/kvm-s390.c
··· 1892 1892 1893 1893 r = set_guest_storage_key(current->mm, hva, keys[i], 0); 1894 1894 if (r) { 1895 - r = fixup_user_fault(current, current->mm, hva, 1895 + r = fixup_user_fault(current->mm, hva, 1896 1896 FAULT_FLAG_WRITE, &unlocked); 1897 1897 if (r) 1898 1898 break;
+4 -4
arch/s390/kvm/priv.c
··· 273 273 rc = get_guest_storage_key(current->mm, vmaddr, &key); 274 274 275 275 if (rc) { 276 - rc = fixup_user_fault(current, current->mm, vmaddr, 276 + rc = fixup_user_fault(current->mm, vmaddr, 277 277 FAULT_FLAG_WRITE, &unlocked); 278 278 if (!rc) { 279 279 mmap_read_unlock(current->mm); ··· 319 319 mmap_read_lock(current->mm); 320 320 rc = reset_guest_reference_bit(current->mm, vmaddr); 321 321 if (rc < 0) { 322 - rc = fixup_user_fault(current, current->mm, vmaddr, 322 + rc = fixup_user_fault(current->mm, vmaddr, 323 323 FAULT_FLAG_WRITE, &unlocked); 324 324 if (!rc) { 325 325 mmap_read_unlock(current->mm); ··· 390 390 m3 & SSKE_MC); 391 391 392 392 if (rc < 0) { 393 - rc = fixup_user_fault(current, current->mm, vmaddr, 393 + rc = fixup_user_fault(current->mm, vmaddr, 394 394 FAULT_FLAG_WRITE, &unlocked); 395 395 rc = !rc ? -EAGAIN : rc; 396 396 } ··· 1094 1094 rc = cond_set_guest_storage_key(current->mm, vmaddr, 1095 1095 key, NULL, nq, mr, mc); 1096 1096 if (rc < 0) { 1097 - rc = fixup_user_fault(current, current->mm, vmaddr, 1097 + rc = fixup_user_fault(current->mm, vmaddr, 1098 1098 FAULT_FLAG_WRITE, &unlocked); 1099 1099 rc = !rc ? -EAGAIN : rc; 1100 1100 }
+2 -2
arch/s390/mm/gmap.c
··· 649 649 rc = vmaddr; 650 650 goto out_up; 651 651 } 652 - if (fixup_user_fault(current, gmap->mm, vmaddr, fault_flags, 652 + if (fixup_user_fault(gmap->mm, vmaddr, fault_flags, 653 653 &unlocked)) { 654 654 rc = -EFAULT; 655 655 goto out_up; ··· 879 879 880 880 BUG_ON(gmap_is_shadow(gmap)); 881 881 fault_flags = (prot == PROT_WRITE) ? FAULT_FLAG_WRITE : 0; 882 - if (fixup_user_fault(current, mm, vmaddr, fault_flags, &unlocked)) 882 + if (fixup_user_fault(mm, vmaddr, fault_flags, &unlocked)) 883 883 return -EFAULT; 884 884 if (unlocked) 885 885 /* lost mmap_lock, caller has to retry __gmap_translate */
+1 -1
drivers/gpu/drm/i915/gem/i915_gem_userptr.c
··· 469 469 locked = 1; 470 470 } 471 471 ret = pin_user_pages_remote 472 - (work->task, mm, 472 + (mm, 473 473 obj->userptr.ptr + pinned * PAGE_SIZE, 474 474 npages - pinned, 475 475 flags,
+1 -1
drivers/infiniband/core/umem_odp.c
··· 439 439 * complex (and doesn't gain us much performance in most use 440 440 * cases). 441 441 */ 442 - npages = get_user_pages_remote(owning_process, owning_mm, 442 + npages = get_user_pages_remote(owning_mm, 443 443 user_virt, gup_num_pages, 444 444 flags, local_page_list, NULL, NULL); 445 445 mmap_read_unlock(owning_mm);
+2 -2
drivers/vfio/vfio_iommu_type1.c
··· 425 425 if (ret) { 426 426 bool unlocked = false; 427 427 428 - ret = fixup_user_fault(NULL, mm, vaddr, 428 + ret = fixup_user_fault(mm, vaddr, 429 429 FAULT_FLAG_REMOTE | 430 430 (write_fault ? FAULT_FLAG_WRITE : 0), 431 431 &unlocked); ··· 453 453 flags |= FOLL_WRITE; 454 454 455 455 mmap_read_lock(mm); 456 - ret = pin_user_pages_remote(NULL, mm, vaddr, 1, flags | FOLL_LONGTERM, 456 + ret = pin_user_pages_remote(mm, vaddr, 1, flags | FOLL_LONGTERM, 457 457 page, NULL, NULL); 458 458 if (ret == 1) { 459 459 *pfn = page_to_pfn(page[0]);
+1 -1
fs/exec.c
··· 217 217 * We are doing an exec(). 'current' is the process 218 218 * doing the exec and bprm->mm is the new process's mm. 219 219 */ 220 - ret = get_user_pages_remote(current, bprm->mm, pos, 1, gup_flags, 220 + ret = get_user_pages_remote(bprm->mm, pos, 1, gup_flags, 221 221 &page, NULL, NULL); 222 222 if (ret <= 0) 223 223 return NULL;
+4 -5
include/linux/mm.h
··· 1661 1661 extern vm_fault_t handle_mm_fault(struct vm_area_struct *vma, 1662 1662 unsigned long address, unsigned int flags, 1663 1663 struct pt_regs *regs); 1664 - extern int fixup_user_fault(struct task_struct *tsk, struct mm_struct *mm, 1664 + extern int fixup_user_fault(struct mm_struct *mm, 1665 1665 unsigned long address, unsigned int fault_flags, 1666 1666 bool *unlocked); 1667 1667 void unmap_mapping_pages(struct address_space *mapping, ··· 1677 1677 BUG(); 1678 1678 return VM_FAULT_SIGBUS; 1679 1679 } 1680 - static inline int fixup_user_fault(struct task_struct *tsk, 1681 - struct mm_struct *mm, unsigned long address, 1680 + static inline int fixup_user_fault(struct mm_struct *mm, unsigned long address, 1682 1681 unsigned int fault_flags, bool *unlocked) 1683 1682 { 1684 1683 /* should never happen if there's no MMU */ ··· 1703 1704 extern int __access_remote_vm(struct task_struct *tsk, struct mm_struct *mm, 1704 1705 unsigned long addr, void *buf, int len, unsigned int gup_flags); 1705 1706 1706 - long get_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm, 1707 + long get_user_pages_remote(struct mm_struct *mm, 1707 1708 unsigned long start, unsigned long nr_pages, 1708 1709 unsigned int gup_flags, struct page **pages, 1709 1710 struct vm_area_struct **vmas, int *locked); 1710 - long pin_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm, 1711 + long pin_user_pages_remote(struct mm_struct *mm, 1711 1712 unsigned long start, unsigned long nr_pages, 1712 1713 unsigned int gup_flags, struct page **pages, 1713 1714 struct vm_area_struct **vmas, int *locked);
+3 -3
kernel/events/uprobes.c
··· 376 376 if (!vaddr || !d) 377 377 return -EINVAL; 378 378 379 - ret = get_user_pages_remote(NULL, mm, vaddr, 1, 379 + ret = get_user_pages_remote(mm, vaddr, 1, 380 380 FOLL_WRITE, &page, &vma, NULL); 381 381 if (unlikely(ret <= 0)) { 382 382 /* ··· 477 477 if (is_register) 478 478 gup_flags |= FOLL_SPLIT_PMD; 479 479 /* Read the page with vaddr into memory */ 480 - ret = get_user_pages_remote(NULL, mm, vaddr, 1, gup_flags, 480 + ret = get_user_pages_remote(mm, vaddr, 1, gup_flags, 481 481 &old_page, &vma, NULL); 482 482 if (ret <= 0) 483 483 return ret; ··· 2029 2029 * but we treat this as a 'remote' access since it is 2030 2030 * essentially a kernel access to the memory. 2031 2031 */ 2032 - result = get_user_pages_remote(NULL, mm, vaddr, 1, FOLL_FORCE, &page, 2032 + result = get_user_pages_remote(mm, vaddr, 1, FOLL_FORCE, &page, 2033 2033 NULL, NULL); 2034 2034 if (result < 0) 2035 2035 return result;
+1 -1
kernel/futex.c
··· 678 678 int ret; 679 679 680 680 mmap_read_lock(mm); 681 - ret = fixup_user_fault(current, mm, (unsigned long)uaddr, 681 + ret = fixup_user_fault(mm, (unsigned long)uaddr, 682 682 FAULT_FLAG_WRITE, NULL); 683 683 mmap_read_unlock(mm); 684 684
+42 -59
mm/gup.c
··· 859 859 * does not include FOLL_NOWAIT, the mmap_lock may be released. If it 860 860 * is, *@locked will be set to 0 and -EBUSY returned. 861 861 */ 862 - static int faultin_page(struct task_struct *tsk, struct vm_area_struct *vma, 862 + static int faultin_page(struct vm_area_struct *vma, 863 863 unsigned long address, unsigned int *flags, int *locked) 864 864 { 865 865 unsigned int fault_flags = 0; ··· 962 962 963 963 /** 964 964 * __get_user_pages() - pin user pages in memory 965 - * @tsk: task_struct of target task 966 965 * @mm: mm_struct of target mm 967 966 * @start: starting user address 968 967 * @nr_pages: number of pages from start to pin ··· 1020 1021 * instead of __get_user_pages. __get_user_pages should be used only if 1021 1022 * you need some special @gup_flags. 1022 1023 */ 1023 - static long __get_user_pages(struct task_struct *tsk, struct mm_struct *mm, 1024 + static long __get_user_pages(struct mm_struct *mm, 1024 1025 unsigned long start, unsigned long nr_pages, 1025 1026 unsigned int gup_flags, struct page **pages, 1026 1027 struct vm_area_struct **vmas, int *locked) ··· 1102 1103 1103 1104 page = follow_page_mask(vma, start, foll_flags, &ctx); 1104 1105 if (!page) { 1105 - ret = faultin_page(tsk, vma, start, &foll_flags, 1106 - locked); 1106 + ret = faultin_page(vma, start, &foll_flags, locked); 1107 1107 switch (ret) { 1108 1108 case 0: 1109 1109 goto retry; ··· 1176 1178 1177 1179 /** 1178 1180 * fixup_user_fault() - manually resolve a user page fault 1179 - * @tsk: the task_struct to use for page fault accounting, or 1180 - * NULL if faults are not to be recorded. 1181 1181 * @mm: mm_struct of target mm 1182 1182 * @address: user address 1183 1183 * @fault_flags:flags to pass down to handle_mm_fault() ··· 1203 1207 * This function will not return with an unlocked mmap_lock. So it has not the 1204 1208 * same semantics wrt the @mm->mmap_lock as does filemap_fault(). 1205 1209 */ 1206 - int fixup_user_fault(struct task_struct *tsk, struct mm_struct *mm, 1210 + int fixup_user_fault(struct mm_struct *mm, 1207 1211 unsigned long address, unsigned int fault_flags, 1208 1212 bool *unlocked) 1209 1213 { ··· 1252 1256 * Please note that this function, unlike __get_user_pages will not 1253 1257 * return 0 for nr_pages > 0 without FOLL_NOWAIT 1254 1258 */ 1255 - static __always_inline long __get_user_pages_locked(struct task_struct *tsk, 1256 - struct mm_struct *mm, 1259 + static __always_inline long __get_user_pages_locked(struct mm_struct *mm, 1257 1260 unsigned long start, 1258 1261 unsigned long nr_pages, 1259 1262 struct page **pages, ··· 1285 1290 pages_done = 0; 1286 1291 lock_dropped = false; 1287 1292 for (;;) { 1288 - ret = __get_user_pages(tsk, mm, start, nr_pages, flags, pages, 1293 + ret = __get_user_pages(mm, start, nr_pages, flags, pages, 1289 1294 vmas, locked); 1290 1295 if (!locked) 1291 1296 /* VM_FAULT_RETRY couldn't trigger, bypass */ ··· 1345 1350 } 1346 1351 1347 1352 *locked = 1; 1348 - ret = __get_user_pages(tsk, mm, start, 1, flags | FOLL_TRIED, 1353 + ret = __get_user_pages(mm, start, 1, flags | FOLL_TRIED, 1349 1354 pages, NULL, locked); 1350 1355 if (!*locked) { 1351 1356 /* Continue to retry until we succeeded */ ··· 1432 1437 * We made sure addr is within a VMA, so the following will 1433 1438 * not result in a stack expansion that recurses back here. 1434 1439 */ 1435 - return __get_user_pages(current, mm, start, nr_pages, gup_flags, 1440 + return __get_user_pages(mm, start, nr_pages, gup_flags, 1436 1441 NULL, NULL, locked); 1437 1442 } 1438 1443 ··· 1516 1521 struct vm_area_struct *vma; 1517 1522 struct page *page; 1518 1523 1519 - if (__get_user_pages(current, current->mm, addr, 1, 1524 + if (__get_user_pages(current->mm, addr, 1, 1520 1525 FOLL_FORCE | FOLL_DUMP | FOLL_GET, &page, &vma, 1521 1526 NULL) < 1) 1522 1527 return NULL; ··· 1525 1530 } 1526 1531 #endif /* CONFIG_ELF_CORE */ 1527 1532 #else /* CONFIG_MMU */ 1528 - static long __get_user_pages_locked(struct task_struct *tsk, 1529 - struct mm_struct *mm, unsigned long start, 1533 + static long __get_user_pages_locked(struct mm_struct *mm, unsigned long start, 1530 1534 unsigned long nr_pages, struct page **pages, 1531 1535 struct vm_area_struct **vmas, int *locked, 1532 1536 unsigned int foll_flags) ··· 1590 1596 } 1591 1597 1592 1598 #ifdef CONFIG_CMA 1593 - static long check_and_migrate_cma_pages(struct task_struct *tsk, 1594 - struct mm_struct *mm, 1599 + static long check_and_migrate_cma_pages(struct mm_struct *mm, 1595 1600 unsigned long start, 1596 1601 unsigned long nr_pages, 1597 1602 struct page **pages, ··· 1668 1675 * again migrating any new CMA pages which we failed to isolate 1669 1676 * earlier. 1670 1677 */ 1671 - ret = __get_user_pages_locked(tsk, mm, start, nr_pages, 1678 + ret = __get_user_pages_locked(mm, start, nr_pages, 1672 1679 pages, vmas, NULL, 1673 1680 gup_flags); 1674 1681 ··· 1682 1689 return ret; 1683 1690 } 1684 1691 #else 1685 - static long check_and_migrate_cma_pages(struct task_struct *tsk, 1686 - struct mm_struct *mm, 1692 + static long check_and_migrate_cma_pages(struct mm_struct *mm, 1687 1693 unsigned long start, 1688 1694 unsigned long nr_pages, 1689 1695 struct page **pages, ··· 1697 1705 * __gup_longterm_locked() is a wrapper for __get_user_pages_locked which 1698 1706 * allows us to process the FOLL_LONGTERM flag. 1699 1707 */ 1700 - static long __gup_longterm_locked(struct task_struct *tsk, 1701 - struct mm_struct *mm, 1708 + static long __gup_longterm_locked(struct mm_struct *mm, 1702 1709 unsigned long start, 1703 1710 unsigned long nr_pages, 1704 1711 struct page **pages, ··· 1722 1731 flags = memalloc_nocma_save(); 1723 1732 } 1724 1733 1725 - rc = __get_user_pages_locked(tsk, mm, start, nr_pages, pages, 1734 + rc = __get_user_pages_locked(mm, start, nr_pages, pages, 1726 1735 vmas_tmp, NULL, gup_flags); 1727 1736 1728 1737 if (gup_flags & FOLL_LONGTERM) { ··· 1736 1745 goto out; 1737 1746 } 1738 1747 1739 - rc = check_and_migrate_cma_pages(tsk, mm, start, rc, pages, 1748 + rc = check_and_migrate_cma_pages(mm, start, rc, pages, 1740 1749 vmas_tmp, gup_flags); 1741 1750 out: 1742 1751 memalloc_nocma_restore(flags); ··· 1747 1756 return rc; 1748 1757 } 1749 1758 #else /* !CONFIG_FS_DAX && !CONFIG_CMA */ 1750 - static __always_inline long __gup_longterm_locked(struct task_struct *tsk, 1751 - struct mm_struct *mm, 1759 + static __always_inline long __gup_longterm_locked(struct mm_struct *mm, 1752 1760 unsigned long start, 1753 1761 unsigned long nr_pages, 1754 1762 struct page **pages, 1755 1763 struct vm_area_struct **vmas, 1756 1764 unsigned int flags) 1757 1765 { 1758 - return __get_user_pages_locked(tsk, mm, start, nr_pages, pages, vmas, 1766 + return __get_user_pages_locked(mm, start, nr_pages, pages, vmas, 1759 1767 NULL, flags); 1760 1768 } 1761 1769 #endif /* CONFIG_FS_DAX || CONFIG_CMA */ 1762 1770 1763 1771 #ifdef CONFIG_MMU 1764 - static long __get_user_pages_remote(struct task_struct *tsk, 1765 - struct mm_struct *mm, 1772 + static long __get_user_pages_remote(struct mm_struct *mm, 1766 1773 unsigned long start, unsigned long nr_pages, 1767 1774 unsigned int gup_flags, struct page **pages, 1768 1775 struct vm_area_struct **vmas, int *locked) ··· 1779 1790 * This will check the vmas (even if our vmas arg is NULL) 1780 1791 * and return -ENOTSUPP if DAX isn't allowed in this case: 1781 1792 */ 1782 - return __gup_longterm_locked(tsk, mm, start, nr_pages, pages, 1793 + return __gup_longterm_locked(mm, start, nr_pages, pages, 1783 1794 vmas, gup_flags | FOLL_TOUCH | 1784 1795 FOLL_REMOTE); 1785 1796 } 1786 1797 1787 - return __get_user_pages_locked(tsk, mm, start, nr_pages, pages, vmas, 1798 + return __get_user_pages_locked(mm, start, nr_pages, pages, vmas, 1788 1799 locked, 1789 1800 gup_flags | FOLL_TOUCH | FOLL_REMOTE); 1790 1801 } 1791 1802 1792 1803 /** 1793 1804 * get_user_pages_remote() - pin user pages in memory 1794 - * @tsk: the task_struct to use for page fault accounting, or 1795 - * NULL if faults are not to be recorded. 1796 1805 * @mm: mm_struct of target mm 1797 1806 * @start: starting user address 1798 1807 * @nr_pages: number of pages from start to pin ··· 1849 1862 * should use get_user_pages_remote because it cannot pass 1850 1863 * FAULT_FLAG_ALLOW_RETRY to handle_mm_fault. 1851 1864 */ 1852 - long get_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm, 1865 + long get_user_pages_remote(struct mm_struct *mm, 1853 1866 unsigned long start, unsigned long nr_pages, 1854 1867 unsigned int gup_flags, struct page **pages, 1855 1868 struct vm_area_struct **vmas, int *locked) ··· 1861 1874 if (WARN_ON_ONCE(gup_flags & FOLL_PIN)) 1862 1875 return -EINVAL; 1863 1876 1864 - return __get_user_pages_remote(tsk, mm, start, nr_pages, gup_flags, 1877 + return __get_user_pages_remote(mm, start, nr_pages, gup_flags, 1865 1878 pages, vmas, locked); 1866 1879 } 1867 1880 EXPORT_SYMBOL(get_user_pages_remote); 1868 1881 1869 1882 #else /* CONFIG_MMU */ 1870 - long get_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm, 1883 + long get_user_pages_remote(struct mm_struct *mm, 1871 1884 unsigned long start, unsigned long nr_pages, 1872 1885 unsigned int gup_flags, struct page **pages, 1873 1886 struct vm_area_struct **vmas, int *locked) ··· 1875 1888 return 0; 1876 1889 } 1877 1890 1878 - static long __get_user_pages_remote(struct task_struct *tsk, 1879 - struct mm_struct *mm, 1891 + static long __get_user_pages_remote(struct mm_struct *mm, 1880 1892 unsigned long start, unsigned long nr_pages, 1881 1893 unsigned int gup_flags, struct page **pages, 1882 1894 struct vm_area_struct **vmas, int *locked) ··· 1895 1909 * @vmas: array of pointers to vmas corresponding to each page. 1896 1910 * Or NULL if the caller does not require them. 1897 1911 * 1898 - * This is the same as get_user_pages_remote(), just with a 1899 - * less-flexible calling convention where we assume that the task 1900 - * and mm being operated on are the current task's and don't allow 1901 - * passing of a locked parameter. We also obviously don't pass 1902 - * FOLL_REMOTE in here. 1912 + * This is the same as get_user_pages_remote(), just with a less-flexible 1913 + * calling convention where we assume that the mm being operated on belongs to 1914 + * the current task, and doesn't allow passing of a locked parameter. We also 1915 + * obviously don't pass FOLL_REMOTE in here. 1903 1916 */ 1904 1917 long get_user_pages(unsigned long start, unsigned long nr_pages, 1905 1918 unsigned int gup_flags, struct page **pages, ··· 1911 1926 if (WARN_ON_ONCE(gup_flags & FOLL_PIN)) 1912 1927 return -EINVAL; 1913 1928 1914 - return __gup_longterm_locked(current, current->mm, start, nr_pages, 1929 + return __gup_longterm_locked(current->mm, start, nr_pages, 1915 1930 pages, vmas, gup_flags | FOLL_TOUCH); 1916 1931 } 1917 1932 EXPORT_SYMBOL(get_user_pages); ··· 1921 1936 * 1922 1937 * mmap_read_lock(mm); 1923 1938 * do_something() 1924 - * get_user_pages(tsk, mm, ..., pages, NULL); 1939 + * get_user_pages(mm, ..., pages, NULL); 1925 1940 * mmap_read_unlock(mm); 1926 1941 * 1927 1942 * to: ··· 1929 1944 * int locked = 1; 1930 1945 * mmap_read_lock(mm); 1931 1946 * do_something() 1932 - * get_user_pages_locked(tsk, mm, ..., pages, &locked); 1947 + * get_user_pages_locked(mm, ..., pages, &locked); 1933 1948 * if (locked) 1934 1949 * mmap_read_unlock(mm); 1935 1950 * ··· 1967 1982 if (WARN_ON_ONCE(gup_flags & FOLL_PIN)) 1968 1983 return -EINVAL; 1969 1984 1970 - return __get_user_pages_locked(current, current->mm, start, nr_pages, 1985 + return __get_user_pages_locked(current->mm, start, nr_pages, 1971 1986 pages, NULL, locked, 1972 1987 gup_flags | FOLL_TOUCH); 1973 1988 } ··· 1977 1992 * get_user_pages_unlocked() is suitable to replace the form: 1978 1993 * 1979 1994 * mmap_read_lock(mm); 1980 - * get_user_pages(tsk, mm, ..., pages, NULL); 1995 + * get_user_pages(mm, ..., pages, NULL); 1981 1996 * mmap_read_unlock(mm); 1982 1997 * 1983 1998 * with: 1984 1999 * 1985 - * get_user_pages_unlocked(tsk, mm, ..., pages); 2000 + * get_user_pages_unlocked(mm, ..., pages); 1986 2001 * 1987 2002 * It is functionally equivalent to get_user_pages_fast so 1988 2003 * get_user_pages_fast should be used instead if specific gup_flags ··· 2005 2020 return -EINVAL; 2006 2021 2007 2022 mmap_read_lock(mm); 2008 - ret = __get_user_pages_locked(current, mm, start, nr_pages, pages, NULL, 2023 + ret = __get_user_pages_locked(mm, start, nr_pages, pages, NULL, 2009 2024 &locked, gup_flags | FOLL_TOUCH); 2010 2025 if (locked) 2011 2026 mmap_read_unlock(mm); ··· 2650 2665 */ 2651 2666 if (gup_flags & FOLL_LONGTERM) { 2652 2667 mmap_read_lock(current->mm); 2653 - ret = __gup_longterm_locked(current, current->mm, 2668 + ret = __gup_longterm_locked(current->mm, 2654 2669 start, nr_pages, 2655 2670 pages, NULL, gup_flags); 2656 2671 mmap_read_unlock(current->mm); ··· 2893 2908 EXPORT_SYMBOL_GPL(pin_user_pages_fast_only); 2894 2909 2895 2910 /** 2896 - * pin_user_pages_remote() - pin pages of a remote process (task != current) 2911 + * pin_user_pages_remote() - pin pages of a remote process 2897 2912 * 2898 - * @tsk: the task_struct to use for page fault accounting, or 2899 - * NULL if faults are not to be recorded. 2900 2913 * @mm: mm_struct of target mm 2901 2914 * @start: starting user address 2902 2915 * @nr_pages: number of pages from start to pin ··· 2915 2932 * FOLL_PIN means that the pages must be released via unpin_user_page(). Please 2916 2933 * see Documentation/core-api/pin_user_pages.rst for details. 2917 2934 */ 2918 - long pin_user_pages_remote(struct task_struct *tsk, struct mm_struct *mm, 2935 + long pin_user_pages_remote(struct mm_struct *mm, 2919 2936 unsigned long start, unsigned long nr_pages, 2920 2937 unsigned int gup_flags, struct page **pages, 2921 2938 struct vm_area_struct **vmas, int *locked) ··· 2925 2942 return -EINVAL; 2926 2943 2927 2944 gup_flags |= FOLL_PIN; 2928 - return __get_user_pages_remote(tsk, mm, start, nr_pages, gup_flags, 2945 + return __get_user_pages_remote(mm, start, nr_pages, gup_flags, 2929 2946 pages, vmas, locked); 2930 2947 } 2931 2948 EXPORT_SYMBOL(pin_user_pages_remote); ··· 2957 2974 return -EINVAL; 2958 2975 2959 2976 gup_flags |= FOLL_PIN; 2960 - return __gup_longterm_locked(current, current->mm, start, nr_pages, 2977 + return __gup_longterm_locked(current->mm, start, nr_pages, 2961 2978 pages, vmas, gup_flags); 2962 2979 } 2963 2980 EXPORT_SYMBOL(pin_user_pages); ··· 3002 3019 return -EINVAL; 3003 3020 3004 3021 gup_flags |= FOLL_PIN; 3005 - return __get_user_pages_locked(current, current->mm, start, nr_pages, 3022 + return __get_user_pages_locked(current->mm, start, nr_pages, 3006 3023 pages, NULL, locked, 3007 3024 gup_flags | FOLL_TOUCH); 3008 3025 }
+1 -1
mm/memory.c
··· 4742 4742 void *maddr; 4743 4743 struct page *page = NULL; 4744 4744 4745 - ret = get_user_pages_remote(tsk, mm, addr, 1, 4745 + ret = get_user_pages_remote(mm, addr, 1, 4746 4746 gup_flags, &page, &vma, NULL); 4747 4747 if (ret <= 0) { 4748 4748 #ifndef CONFIG_HAVE_IOREMAP_PROT
+1 -1
mm/process_vm_access.c
··· 105 105 * current/current->mm 106 106 */ 107 107 mmap_read_lock(mm); 108 - pinned_pages = pin_user_pages_remote(task, mm, pa, pinned_pages, 108 + pinned_pages = pin_user_pages_remote(mm, pa, pinned_pages, 109 109 flags, process_pages, 110 110 NULL, &locked); 111 111 if (locked)
+1 -1
security/tomoyo/domain.c
··· 914 914 * (represented by bprm). 'current' is the process doing 915 915 * the execve(). 916 916 */ 917 - if (get_user_pages_remote(current, bprm->mm, pos, 1, 917 + if (get_user_pages_remote(bprm->mm, pos, 1, 918 918 FOLL_FORCE, &page, NULL, NULL) <= 0) 919 919 return false; 920 920 #else
+1 -1
virt/kvm/async_pf.c
··· 61 61 * access remotely. 62 62 */ 63 63 mmap_read_lock(mm); 64 - get_user_pages_remote(NULL, mm, addr, 1, FOLL_WRITE, NULL, NULL, 64 + get_user_pages_remote(mm, addr, 1, FOLL_WRITE, NULL, NULL, 65 65 &locked); 66 66 if (locked) 67 67 mmap_read_unlock(mm);
+1 -1
virt/kvm/kvm_main.c
··· 1893 1893 * not call the fault handler, so do it here. 1894 1894 */ 1895 1895 bool unlocked = false; 1896 - r = fixup_user_fault(current, current->mm, addr, 1896 + r = fixup_user_fault(current->mm, addr, 1897 1897 (write_fault ? FAULT_FLAG_WRITE : 0), 1898 1898 &unlocked); 1899 1899 if (unlocked)