History

Merge tag 'drm-next-2020-04-03-1' of git://anongit.freedesktop.org/drm/drm

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

Linus Torvalds committed 6 years ago

Commit ea9448b2 parents 83eb69f 0e7e61916 files · +692 −28Browse files

Showing the changes to include/linux (3 of 16 files). Show all

Unified · Split

3 files
  1. include/linux/fs.h +1 −1
  2. include/linux/huge_mm.h +39 −2
  3. include/linux/mm.h +17 −0
include/linux/fs.h+1−1
@@ -3399,7 +3399,7 @@ static inline bool io_is_direct(struct file *filp) · 3398 unmodified lines
33993399 return (filp->f_flags & O_DIRECT) || IS_DAX(filp->f_mapping->host);
34003400 }
34013401
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)
34033403 {
34043404 return vma->vm_file && IS_DAX(vma->vm_file->f_mapping->host);
34053405 }
include/linux/huge_mm.h+39−2
@@ -47,8 +47,45 @@ extern bool move_huge_pmd(struct vm_area_struct *vma, unsigned long old_addr, · 46 unmodified lines
4747 extern int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
4848 unsigned long addr, pgprot_t newprot,
4949 int prot_numa);
50−vm_fault_t vmf_insert_pfn_pmd(struct vm_fault *vmf, pfn_t pfn, bool write);
51−vm_fault_t vmf_insert_pfn_pud(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+ 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+
5289 enum transparent_hugepage_flag {
5390 TRANSPARENT_HUGEPAGE_FLAG,
5491 TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG,
include/linux/mm.h+17−0
@@ -3014,6 +3014,23 @@ extern long copy_huge_page_from_user(struct page *dst_page, · 3013 unmodified lines
30143014 const void __user *usr_src,
30153015 unsigned int pages_per_huge_page,
30163016 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+
30173034 #endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */
30183035
30193036 #ifdef CONFIG_DEBUG_PAGEALLOC