gup.c (39656e83dab918861931ef96e5c41731b0899e56) | gup.c (67a929e097b774c69253c8b61ef9eb8a42b463a3) |
---|---|
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> --- 1637 unchanged lines hidden (view full) --- 1646 NULL) < 1) 1647 return NULL; 1648 flush_cache_page(vma, addr, page_to_pfn(page)); 1649 return page; 1650} 1651#endif /* CONFIG_ELF_CORE */ 1652 1653/* | 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> --- 1637 unchanged lines hidden (view full) --- 1646 NULL) < 1) 1647 return NULL; 1648 flush_cache_page(vma, addr, page_to_pfn(page)); 1649 return page; 1650} 1651#endif /* CONFIG_ELF_CORE */ 1652 1653/* |
1654 * Generic Fast GUP | 1654 * Fast GUP |
1655 * 1656 * get_user_pages_fast attempts to pin user pages by walking the page 1657 * tables directly and avoids taking locks. Thus the walker needs to be 1658 * protected from page table pages being freed from under it, and should 1659 * block any THP splits. 1660 * 1661 * One way to achieve this is to have the walker disable interrupts, and 1662 * rely on IPIs from the TLB flushing code blocking before the page table --- 15 unchanged lines hidden (view full) --- 1678 * *) ptes can be read atomically by the architecture. 1679 * 1680 * *) access_ok is sufficient to validate userspace address ranges. 1681 * 1682 * The last two assumptions can be relaxed by the addition of helper functions. 1683 * 1684 * This code is based heavily on the PowerPC implementation by Nick Piggin. 1685 */ | 1655 * 1656 * get_user_pages_fast attempts to pin user pages by walking the page 1657 * tables directly and avoids taking locks. Thus the walker needs to be 1658 * protected from page table pages being freed from under it, and should 1659 * block any THP splits. 1660 * 1661 * One way to achieve this is to have the walker disable interrupts, and 1662 * rely on IPIs from the TLB flushing code blocking before the page table --- 15 unchanged lines hidden (view full) --- 1678 * *) ptes can be read atomically by the architecture. 1679 * 1680 * *) access_ok is sufficient to validate userspace address ranges. 1681 * 1682 * The last two assumptions can be relaxed by the addition of helper functions. 1683 * 1684 * This code is based heavily on the PowerPC implementation by Nick Piggin. 1685 */ |
1686#ifdef CONFIG_HAVE_GENERIC_GUP | 1686#ifdef CONFIG_HAVE_FAST_GUP |
1687#ifdef CONFIG_GUP_GET_PTE_LOW_HIGH 1688/* 1689 * WARNING: only to be used in the get_user_pages_fast() implementation. 1690 * 1691 * With get_user_pages_fast(), we walk down the pagetables without taking any 1692 * locks. For this we would like to load the pointers atomically, but sometimes 1693 * that is not possible (e.g. without expensive cmpxchg8b on x86_32 PAE). What 1694 * we do have is the guarantee that a PTE will only either go from not present --- 606 unchanged lines hidden --- | 1687#ifdef CONFIG_GUP_GET_PTE_LOW_HIGH 1688/* 1689 * WARNING: only to be used in the get_user_pages_fast() implementation. 1690 * 1691 * With get_user_pages_fast(), we walk down the pagetables without taking any 1692 * locks. For this we would like to load the pointers atomically, but sometimes 1693 * that is not possible (e.g. without expensive cmpxchg8b on x86_32 PAE). What 1694 * we do have is the guarantee that a PTE will only either go from not present --- 606 unchanged lines hidden --- |