Pull drm hugepage support from Dave Airlie: "This adds support for hugepages to TTM and has been tested with the vmwgfx drivers, though I expect other drivers to start using it" * tag 'drm-next-2020-04-03-1' of git://anongit.freedesktop.org/drm/drm: drm/vmwgfx: Hook up the helpers to align buffer objects drm/vmwgfx: Introduce a huge page aligning TTM range manager drm: Add a drm_get_unmapped_area() helper drm/vmwgfx: Support huge page faults drm/ttm, drm/vmwgfx: Support huge TTM pagefaults mm: Add vmf_insert_pfn_xxx_prot() for huge page-table entries mm: Split huge pages on write-notify or COW mm: Introduce vma_is_special_huge fs: Constify vma argument to vma_is_dax
Showing the changes to include/linux (3 of 16 files). Show all
Unified · Split
| @@ -3399,7 +3399,7 @@ static inline bool io_is_direct(struct file *filp) · 3398 unmodified lines | |||
| 3399 | return (filp->f_flags & O_DIRECT) || IS_DAX(filp->f_mapping->host); | 3399 | return (filp->f_flags & O_DIRECT) || IS_DAX(filp->f_mapping->host); |
| 3400 | } | 3400 | } |
| 3401 | 3401 | ||
| 3402 | static inline bool vma_is_dax(struct vm_area_struct *vma) | 3402 | static inline bool vma_is_dax(const struct vm_area_struct *vma) |
| 3403 | { | 3403 | { |
| 3404 | return vma->vm_file && IS_DAX(vma->vm_file->f_mapping->host); | 3404 | return vma->vm_file && IS_DAX(vma->vm_file->f_mapping->host); |
| 3405 | } | 3405 | } |
| @@ -47,8 +47,45 @@ extern bool move_huge_pmd(struct vm_area_struct *vma, unsigned long old_addr, · 46 unmodified lines | |||
| 47 | extern int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, | 47 | extern int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, |
| 48 | unsigned long addr, pgprot_t newprot, | 48 | unsigned long addr, pgprot_t newprot, |
| 49 | int prot_numa); | 49 | int prot_numa); |
| 50 | vm_fault_t vmf_insert_pfn_pmd(struct vm_fault *vmf, pfn_t pfn, bool write); | 50 | vm_fault_t vmf_insert_pfn_pmd_prot(struct vm_fault *vmf, pfn_t pfn, |
| 51 | vm_fault_t vmf_insert_pfn_pud(struct vm_fault *vmf, pfn_t pfn, bool write); | 51 | pgprot_t pgprot, bool write); |
| 52 | |||
| 53 | /** | ||
| 54 | * vmf_insert_pfn_pmd - insert a pmd size pfn | ||
| 55 | * @vmf: Structure describing the fault | ||
| 56 | * @pfn: pfn to insert | ||
| 57 | * @pgprot: page protection to use | ||
| 58 | * @write: whether it's a write fault | ||
| 59 | * | ||
| 60 | * Insert a pmd size pfn. See vmf_insert_pfn() for additional info. | ||
| 61 | * | ||
| 62 | * Return: vm_fault_t value. | ||
| 63 | */ | ||
| 64 | static inline vm_fault_t vmf_insert_pfn_pmd(struct vm_fault *vmf, pfn_t pfn, | ||
| 65 | bool write) | ||
| 66 | { | ||
| 67 | return vmf_insert_pfn_pmd_prot(vmf, pfn, vmf->vma->vm_page_prot, write); | ||
| 68 | } | ||
| 69 | vm_fault_t vmf_insert_pfn_pud_prot(struct vm_fault *vmf, pfn_t pfn, | ||
| 70 | pgprot_t pgprot, bool write); | ||
| 71 | |||
| 72 | /** | ||
| 73 | * vmf_insert_pfn_pud - insert a pud size pfn | ||
| 74 | * @vmf: Structure describing the fault | ||
| 75 | * @pfn: pfn to insert | ||
| 76 | * @pgprot: page protection to use | ||
| 77 | * @write: whether it's a write fault | ||
| 78 | * | ||
| 79 | * Insert a pud size pfn. See vmf_insert_pfn() for additional info. | ||
| 80 | * | ||
| 81 | * Return: vm_fault_t value. | ||
| 82 | */ | ||
| 83 | static inline vm_fault_t vmf_insert_pfn_pud(struct vm_fault *vmf, pfn_t pfn, | ||
| 84 | bool write) | ||
| 85 | { | ||
| 86 | return vmf_insert_pfn_pud_prot(vmf, pfn, vmf->vma->vm_page_prot, write); | ||
| 87 | } | ||
| 88 | |||
| 52 | enum transparent_hugepage_flag { | 89 | enum transparent_hugepage_flag { |
| 53 | TRANSPARENT_HUGEPAGE_FLAG, | 90 | TRANSPARENT_HUGEPAGE_FLAG, |
| 54 | TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG, | 91 | TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG, |
| @@ -3014,6 +3014,23 @@ extern long copy_huge_page_from_user(struct page *dst_page, · 3013 unmodified lines | |||
| 3014 | const void __user *usr_src, | 3014 | const void __user *usr_src, |
| 3015 | unsigned int pages_per_huge_page, | 3015 | unsigned int pages_per_huge_page, |
| 3016 | bool allow_pagefault); | 3016 | bool allow_pagefault); |
| 3017 | |||
| 3018 | /** | ||
| 3019 | * vma_is_special_huge - Are transhuge page-table entries considered special? | ||
| 3020 | * @vma: Pointer to the struct vm_area_struct to consider | ||
| 3021 | * | ||
| 3022 | * Whether transhuge page-table entries are considered "special" following | ||
| 3023 | * the definition in vm_normal_page(). | ||
| 3024 | * | ||
| 3025 | * Return: true if transhuge page-table entries should be considered special, | ||
| 3026 | * false otherwise. | ||
| 3027 | */ | ||
| 3028 | static inline bool vma_is_special_huge(const struct vm_area_struct *vma) | ||
| 3029 | { | ||
| 3030 | return vma_is_dax(vma) || (vma->vm_file && | ||
| 3031 | (vma->vm_flags & (VM_PFNMAP | VM_MIXEDMAP))); | ||
| 3032 | } | ||
| 3033 | |||
| 3017 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */ | 3034 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */ |
| 3018 | 3035 | ||
| 3019 | #ifdef CONFIG_DEBUG_PAGEALLOC | 3036 | #ifdef CONFIG_DEBUG_PAGEALLOC |