drm: add support for hugepages to TTM
-----BEGIN PGP SIGNATURE----- iQIcBAABAgAGBQJehnToAAoJEAx081l5xIa+bYEP/3IW+bip83OSR/Ay/29qmeBh FMZjz9G+jClVArea+8dlbmGohpQfkLuBiDBE1Ujxl9iqsm3STdIdbv9bHccqs2g8 mtptkZ5qKwuOi7NhcNG5E5vy60bEAbZ9/QtXok5nckega2sdP7cr+uzZgp/Zc/Vo v9H8Wk6/l/MUF8agIXmgChpXII17lIyYbtbH5NV+PpsZMhAaAg2g4Z4vBP5Ue+Nc myNcdzKLF3nq++gBfIZ4gzAAnnqN2eYFvkSdvRSdn9HuXcur1tQHjMwC/DJuk8h7 5dsaplrRLceMEqn6d61oWBJclPefXlkazvHzqNA9Zwr98yVev5h7tiT3BKNVTbKW iPoXCt55fJosvXAsJxW4UgXZy7kMGZdZ8GmSlwmZsA0kJRvOuuvWChvu/ugwnIeR DUWb5sa0Bn9aoczJ4Qq61O7CqtvhOf6NK24Jcc/HSk/iDbZ2tEnCPEXeCm0GibQ5 PAFLfE1fZUcEeZlOp+zbZ6ni6XbLL9LX2Dkum/3zEvhf1rdF+0692ZM4o9VwedAX 2TpE4kywhbYxhUq3MbyRzP3knu7pJYb0KCOfyg6Rqn/vCo17+PksRF+6XvzUVlzr VtRYU87TVP5FqIw+e3yela2alP/oo4kEe37n536TcRgFtU7vItcCA5vLuDSOivjX 08B6Hy4QK2M0yKFuuAT5 =KO6E -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
ea9448b254
16 changed files with 692 additions and 28 deletions
|
|
@ -3399,7 +3399,7 @@ static inline bool io_is_direct(struct file *filp)
|
|||
return (filp->f_flags & O_DIRECT) || IS_DAX(filp->f_mapping->host);
|
||||
}
|
||||
|
||||
static inline bool vma_is_dax(struct vm_area_struct *vma)
|
||||
static inline bool vma_is_dax(const struct vm_area_struct *vma)
|
||||
{
|
||||
return vma->vm_file && IS_DAX(vma->vm_file->f_mapping->host);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,8 +47,45 @@ extern bool move_huge_pmd(struct vm_area_struct *vma, unsigned long old_addr,
|
|||
extern int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
|
||||
unsigned long addr, pgprot_t newprot,
|
||||
int prot_numa);
|
||||
vm_fault_t vmf_insert_pfn_pmd(struct vm_fault *vmf, pfn_t pfn, bool write);
|
||||
vm_fault_t vmf_insert_pfn_pud(struct vm_fault *vmf, pfn_t pfn, bool write);
|
||||
vm_fault_t vmf_insert_pfn_pmd_prot(struct vm_fault *vmf, pfn_t pfn,
|
||||
pgprot_t pgprot, bool write);
|
||||
|
||||
/**
|
||||
* vmf_insert_pfn_pmd - insert a pmd size pfn
|
||||
* @vmf: Structure describing the fault
|
||||
* @pfn: pfn to insert
|
||||
* @pgprot: page protection to use
|
||||
* @write: whether it's a write fault
|
||||
*
|
||||
* Insert a pmd size pfn. See vmf_insert_pfn() for additional info.
|
||||
*
|
||||
* Return: vm_fault_t value.
|
||||
*/
|
||||
static inline vm_fault_t vmf_insert_pfn_pmd(struct vm_fault *vmf, pfn_t pfn,
|
||||
bool write)
|
||||
{
|
||||
return vmf_insert_pfn_pmd_prot(vmf, pfn, vmf->vma->vm_page_prot, write);
|
||||
}
|
||||
vm_fault_t vmf_insert_pfn_pud_prot(struct vm_fault *vmf, pfn_t pfn,
|
||||
pgprot_t pgprot, bool write);
|
||||
|
||||
/**
|
||||
* vmf_insert_pfn_pud - insert a pud size pfn
|
||||
* @vmf: Structure describing the fault
|
||||
* @pfn: pfn to insert
|
||||
* @pgprot: page protection to use
|
||||
* @write: whether it's a write fault
|
||||
*
|
||||
* Insert a pud size pfn. See vmf_insert_pfn() for additional info.
|
||||
*
|
||||
* Return: vm_fault_t value.
|
||||
*/
|
||||
static inline vm_fault_t vmf_insert_pfn_pud(struct vm_fault *vmf, pfn_t pfn,
|
||||
bool write)
|
||||
{
|
||||
return vmf_insert_pfn_pud_prot(vmf, pfn, vmf->vma->vm_page_prot, write);
|
||||
}
|
||||
|
||||
enum transparent_hugepage_flag {
|
||||
TRANSPARENT_HUGEPAGE_FLAG,
|
||||
TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG,
|
||||
|
|
|
|||
|
|
@ -3014,6 +3014,23 @@ extern long copy_huge_page_from_user(struct page *dst_page,
|
|||
const void __user *usr_src,
|
||||
unsigned int pages_per_huge_page,
|
||||
bool allow_pagefault);
|
||||
|
||||
/**
|
||||
* vma_is_special_huge - Are transhuge page-table entries considered special?
|
||||
* @vma: Pointer to the struct vm_area_struct to consider
|
||||
*
|
||||
* Whether transhuge page-table entries are considered "special" following
|
||||
* the definition in vm_normal_page().
|
||||
*
|
||||
* Return: true if transhuge page-table entries should be considered special,
|
||||
* false otherwise.
|
||||
*/
|
||||
static inline bool vma_is_special_huge(const struct vm_area_struct *vma)
|
||||
{
|
||||
return vma_is_dax(vma) || (vma->vm_file &&
|
||||
(vma->vm_flags & (VM_PFNMAP | VM_MIXEDMAP)));
|
||||
}
|
||||
|
||||
#endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */
|
||||
|
||||
#ifdef CONFIG_DEBUG_PAGEALLOC
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue