|
@@ -6,6 +6,18 @@ extern int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm,
|
|
pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr,
|
|
pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr,
|
|
struct vm_area_struct *vma);
|
|
struct vm_area_struct *vma);
|
|
extern void huge_pmd_set_accessed(struct vm_fault *vmf, pmd_t orig_pmd);
|
|
extern void huge_pmd_set_accessed(struct vm_fault *vmf, pmd_t orig_pmd);
|
|
|
|
+extern int copy_huge_pud(struct mm_struct *dst_mm, struct mm_struct *src_mm,
|
|
|
|
+ pud_t *dst_pud, pud_t *src_pud, unsigned long addr,
|
|
|
|
+ struct vm_area_struct *vma);
|
|
|
|
+
|
|
|
|
+#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
|
|
|
|
+extern void huge_pud_set_accessed(struct vm_fault *vmf, pud_t orig_pud);
|
|
|
|
+#else
|
|
|
|
+static inline void huge_pud_set_accessed(struct vm_fault *vmf, pud_t orig_pud)
|
|
|
|
+{
|
|
|
|
+}
|
|
|
|
+#endif
|
|
|
|
+
|
|
extern int do_huge_pmd_wp_page(struct vm_fault *vmf, pmd_t orig_pmd);
|
|
extern int do_huge_pmd_wp_page(struct vm_fault *vmf, pmd_t orig_pmd);
|
|
extern struct page *follow_trans_huge_pmd(struct vm_area_struct *vma,
|
|
extern struct page *follow_trans_huge_pmd(struct vm_area_struct *vma,
|
|
unsigned long addr,
|
|
unsigned long addr,
|
|
@@ -17,6 +29,9 @@ extern bool madvise_free_huge_pmd(struct mmu_gather *tlb,
|
|
extern int zap_huge_pmd(struct mmu_gather *tlb,
|
|
extern int zap_huge_pmd(struct mmu_gather *tlb,
|
|
struct vm_area_struct *vma,
|
|
struct vm_area_struct *vma,
|
|
pmd_t *pmd, unsigned long addr);
|
|
pmd_t *pmd, unsigned long addr);
|
|
|
|
+extern int zap_huge_pud(struct mmu_gather *tlb,
|
|
|
|
+ struct vm_area_struct *vma,
|
|
|
|
+ pud_t *pud, unsigned long addr);
|
|
extern int mincore_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
|
|
extern int mincore_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
|
|
unsigned long addr, unsigned long end,
|
|
unsigned long addr, unsigned long end,
|
|
unsigned char *vec);
|
|
unsigned char *vec);
|
|
@@ -26,8 +41,10 @@ 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,
|
|
extern int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
|
|
unsigned long addr, pgprot_t newprot,
|
|
unsigned long addr, pgprot_t newprot,
|
|
int prot_numa);
|
|
int prot_numa);
|
|
-int vmf_insert_pfn_pmd(struct vm_area_struct *, unsigned long addr, pmd_t *,
|
|
|
|
- pfn_t pfn, bool write);
|
|
|
|
|
|
+int vmf_insert_pfn_pmd(struct vm_area_struct *vma, unsigned long addr,
|
|
|
|
+ pmd_t *pmd, pfn_t pfn, bool write);
|
|
|
|
+int vmf_insert_pfn_pud(struct vm_area_struct *vma, unsigned long addr,
|
|
|
|
+ pud_t *pud, pfn_t pfn, bool write);
|
|
enum transparent_hugepage_flag {
|
|
enum transparent_hugepage_flag {
|
|
TRANSPARENT_HUGEPAGE_FLAG,
|
|
TRANSPARENT_HUGEPAGE_FLAG,
|
|
TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG,
|
|
TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG,
|
|
@@ -58,13 +75,14 @@ extern struct kobj_attribute shmem_enabled_attr;
|
|
#define HPAGE_PMD_NR (1<<HPAGE_PMD_ORDER)
|
|
#define HPAGE_PMD_NR (1<<HPAGE_PMD_ORDER)
|
|
|
|
|
|
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
|
|
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
|
|
-struct page *follow_devmap_pmd(struct vm_area_struct *vma, unsigned long addr,
|
|
|
|
- pmd_t *pmd, int flags);
|
|
|
|
-
|
|
|
|
#define HPAGE_PMD_SHIFT PMD_SHIFT
|
|
#define HPAGE_PMD_SHIFT PMD_SHIFT
|
|
#define HPAGE_PMD_SIZE ((1UL) << HPAGE_PMD_SHIFT)
|
|
#define HPAGE_PMD_SIZE ((1UL) << HPAGE_PMD_SHIFT)
|
|
#define HPAGE_PMD_MASK (~(HPAGE_PMD_SIZE - 1))
|
|
#define HPAGE_PMD_MASK (~(HPAGE_PMD_SIZE - 1))
|
|
|
|
|
|
|
|
+#define HPAGE_PUD_SHIFT PUD_SHIFT
|
|
|
|
+#define HPAGE_PUD_SIZE ((1UL) << HPAGE_PUD_SHIFT)
|
|
|
|
+#define HPAGE_PUD_MASK (~(HPAGE_PUD_SIZE - 1))
|
|
|
|
+
|
|
extern bool is_vma_temporary_stack(struct vm_area_struct *vma);
|
|
extern bool is_vma_temporary_stack(struct vm_area_struct *vma);
|
|
|
|
|
|
#define transparent_hugepage_enabled(__vma) \
|
|
#define transparent_hugepage_enabled(__vma) \
|
|
@@ -118,6 +136,17 @@ void __split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
|
|
void split_huge_pmd_address(struct vm_area_struct *vma, unsigned long address,
|
|
void split_huge_pmd_address(struct vm_area_struct *vma, unsigned long address,
|
|
bool freeze, struct page *page);
|
|
bool freeze, struct page *page);
|
|
|
|
|
|
|
|
+void __split_huge_pud(struct vm_area_struct *vma, pud_t *pud,
|
|
|
|
+ unsigned long address);
|
|
|
|
+
|
|
|
|
+#define split_huge_pud(__vma, __pud, __address) \
|
|
|
|
+ do { \
|
|
|
|
+ pud_t *____pud = (__pud); \
|
|
|
|
+ if (pud_trans_huge(*____pud) \
|
|
|
|
+ || pud_devmap(*____pud)) \
|
|
|
|
+ __split_huge_pud(__vma, __pud, __address); \
|
|
|
|
+ } while (0)
|
|
|
|
+
|
|
extern int hugepage_madvise(struct vm_area_struct *vma,
|
|
extern int hugepage_madvise(struct vm_area_struct *vma,
|
|
unsigned long *vm_flags, int advice);
|
|
unsigned long *vm_flags, int advice);
|
|
extern void vma_adjust_trans_huge(struct vm_area_struct *vma,
|
|
extern void vma_adjust_trans_huge(struct vm_area_struct *vma,
|
|
@@ -126,6 +155,8 @@ extern void vma_adjust_trans_huge(struct vm_area_struct *vma,
|
|
long adjust_next);
|
|
long adjust_next);
|
|
extern spinlock_t *__pmd_trans_huge_lock(pmd_t *pmd,
|
|
extern spinlock_t *__pmd_trans_huge_lock(pmd_t *pmd,
|
|
struct vm_area_struct *vma);
|
|
struct vm_area_struct *vma);
|
|
|
|
+extern spinlock_t *__pud_trans_huge_lock(pud_t *pud,
|
|
|
|
+ struct vm_area_struct *vma);
|
|
/* mmap_sem must be held on entry */
|
|
/* mmap_sem must be held on entry */
|
|
static inline spinlock_t *pmd_trans_huge_lock(pmd_t *pmd,
|
|
static inline spinlock_t *pmd_trans_huge_lock(pmd_t *pmd,
|
|
struct vm_area_struct *vma)
|
|
struct vm_area_struct *vma)
|
|
@@ -136,6 +167,15 @@ static inline spinlock_t *pmd_trans_huge_lock(pmd_t *pmd,
|
|
else
|
|
else
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
+static inline spinlock_t *pud_trans_huge_lock(pud_t *pud,
|
|
|
|
+ struct vm_area_struct *vma)
|
|
|
|
+{
|
|
|
|
+ VM_BUG_ON_VMA(!rwsem_is_locked(&vma->vm_mm->mmap_sem), vma);
|
|
|
|
+ if (pud_trans_huge(*pud) || pud_devmap(*pud))
|
|
|
|
+ return __pud_trans_huge_lock(pud, vma);
|
|
|
|
+ else
|
|
|
|
+ return NULL;
|
|
|
|
+}
|
|
static inline int hpage_nr_pages(struct page *page)
|
|
static inline int hpage_nr_pages(struct page *page)
|
|
{
|
|
{
|
|
if (unlikely(PageTransHuge(page)))
|
|
if (unlikely(PageTransHuge(page)))
|
|
@@ -143,6 +183,11 @@ static inline int hpage_nr_pages(struct page *page)
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+struct page *follow_devmap_pmd(struct vm_area_struct *vma, unsigned long addr,
|
|
|
|
+ pmd_t *pmd, int flags);
|
|
|
|
+struct page *follow_devmap_pud(struct vm_area_struct *vma, unsigned long addr,
|
|
|
|
+ pud_t *pud, int flags);
|
|
|
|
+
|
|
extern int do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t orig_pmd);
|
|
extern int do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t orig_pmd);
|
|
|
|
|
|
extern struct page *huge_zero_page;
|
|
extern struct page *huge_zero_page;
|
|
@@ -157,6 +202,11 @@ static inline bool is_huge_zero_pmd(pmd_t pmd)
|
|
return is_huge_zero_page(pmd_page(pmd));
|
|
return is_huge_zero_page(pmd_page(pmd));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static inline bool is_huge_zero_pud(pud_t pud)
|
|
|
|
+{
|
|
|
|
+ return false;
|
|
|
|
+}
|
|
|
|
+
|
|
struct page *mm_get_huge_zero_page(struct mm_struct *mm);
|
|
struct page *mm_get_huge_zero_page(struct mm_struct *mm);
|
|
void mm_put_huge_zero_page(struct mm_struct *mm);
|
|
void mm_put_huge_zero_page(struct mm_struct *mm);
|
|
|
|
|
|
@@ -167,6 +217,10 @@ void mm_put_huge_zero_page(struct mm_struct *mm);
|
|
#define HPAGE_PMD_MASK ({ BUILD_BUG(); 0; })
|
|
#define HPAGE_PMD_MASK ({ BUILD_BUG(); 0; })
|
|
#define HPAGE_PMD_SIZE ({ BUILD_BUG(); 0; })
|
|
#define HPAGE_PMD_SIZE ({ BUILD_BUG(); 0; })
|
|
|
|
|
|
|
|
+#define HPAGE_PUD_SHIFT ({ BUILD_BUG(); 0; })
|
|
|
|
+#define HPAGE_PUD_MASK ({ BUILD_BUG(); 0; })
|
|
|
|
+#define HPAGE_PUD_SIZE ({ BUILD_BUG(); 0; })
|
|
|
|
+
|
|
#define hpage_nr_pages(x) 1
|
|
#define hpage_nr_pages(x) 1
|
|
|
|
|
|
#define transparent_hugepage_enabled(__vma) 0
|
|
#define transparent_hugepage_enabled(__vma) 0
|
|
@@ -195,6 +249,9 @@ static inline void __split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
|
|
static inline void split_huge_pmd_address(struct vm_area_struct *vma,
|
|
static inline void split_huge_pmd_address(struct vm_area_struct *vma,
|
|
unsigned long address, bool freeze, struct page *page) {}
|
|
unsigned long address, bool freeze, struct page *page) {}
|
|
|
|
|
|
|
|
+#define split_huge_pud(__vma, __pmd, __address) \
|
|
|
|
+ do { } while (0)
|
|
|
|
+
|
|
static inline int hugepage_madvise(struct vm_area_struct *vma,
|
|
static inline int hugepage_madvise(struct vm_area_struct *vma,
|
|
unsigned long *vm_flags, int advice)
|
|
unsigned long *vm_flags, int advice)
|
|
{
|
|
{
|
|
@@ -212,6 +269,11 @@ static inline spinlock_t *pmd_trans_huge_lock(pmd_t *pmd,
|
|
{
|
|
{
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
+static inline spinlock_t *pud_trans_huge_lock(pud_t *pud,
|
|
|
|
+ struct vm_area_struct *vma)
|
|
|
|
+{
|
|
|
|
+ return NULL;
|
|
|
|
+}
|
|
|
|
|
|
static inline int do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t orig_pmd)
|
|
static inline int do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t orig_pmd)
|
|
{
|
|
{
|
|
@@ -223,6 +285,11 @@ static inline bool is_huge_zero_page(struct page *page)
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static inline bool is_huge_zero_pud(pud_t pud)
|
|
|
|
+{
|
|
|
|
+ return false;
|
|
|
|
+}
|
|
|
|
+
|
|
static inline void mm_put_huge_zero_page(struct mm_struct *mm)
|
|
static inline void mm_put_huge_zero_page(struct mm_struct *mm)
|
|
{
|
|
{
|
|
return;
|
|
return;
|
|
@@ -233,6 +300,12 @@ static inline struct page *follow_devmap_pmd(struct vm_area_struct *vma,
|
|
{
|
|
{
|
|
return NULL;
|
|
return NULL;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+static inline struct page *follow_devmap_pud(struct vm_area_struct *vma,
|
|
|
|
+ unsigned long addr, pud_t *pud, int flags)
|
|
|
|
+{
|
|
|
|
+ return NULL;
|
|
|
|
+}
|
|
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
|
|
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
|
|
|
|
|
|
#endif /* _LINUX_HUGE_MM_H */
|
|
#endif /* _LINUX_HUGE_MM_H */
|