Andrea Arcangeli | 71e3aac | 2011-01-13 15:46:52 -0800 | [diff] [blame] | 1 | #ifndef _LINUX_HUGE_MM_H |
| 2 | #define _LINUX_HUGE_MM_H |
| 3 | |
Jan Kara | 82b0f8c | 2016-12-14 15:06:58 -0800 | [diff] [blame] | 4 | extern int do_huge_pmd_anonymous_page(struct vm_fault *vmf); |
Andrea Arcangeli | 71e3aac | 2011-01-13 15:46:52 -0800 | [diff] [blame] | 5 | extern int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm, |
| 6 | pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr, |
| 7 | struct vm_area_struct *vma); |
Jan Kara | 82b0f8c | 2016-12-14 15:06:58 -0800 | [diff] [blame] | 8 | extern void huge_pmd_set_accessed(struct vm_fault *vmf, pmd_t orig_pmd); |
Matthew Wilcox | a00cc7d | 2017-02-24 14:57:02 -0800 | [diff] [blame] | 9 | extern int copy_huge_pud(struct mm_struct *dst_mm, struct mm_struct *src_mm, |
| 10 | pud_t *dst_pud, pud_t *src_pud, unsigned long addr, |
| 11 | struct vm_area_struct *vma); |
| 12 | |
| 13 | #ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD |
| 14 | extern void huge_pud_set_accessed(struct vm_fault *vmf, pud_t orig_pud); |
| 15 | #else |
| 16 | static inline void huge_pud_set_accessed(struct vm_fault *vmf, pud_t orig_pud) |
| 17 | { |
| 18 | } |
| 19 | #endif |
| 20 | |
Jan Kara | 82b0f8c | 2016-12-14 15:06:58 -0800 | [diff] [blame] | 21 | extern int do_huge_pmd_wp_page(struct vm_fault *vmf, pmd_t orig_pmd); |
David Rientjes | b676b29 | 2012-10-08 16:34:03 -0700 | [diff] [blame] | 22 | extern struct page *follow_trans_huge_pmd(struct vm_area_struct *vma, |
Andrea Arcangeli | 71e3aac | 2011-01-13 15:46:52 -0800 | [diff] [blame] | 23 | unsigned long addr, |
| 24 | pmd_t *pmd, |
| 25 | unsigned int flags); |
Huang Ying | 319904a | 2016-07-28 15:48:03 -0700 | [diff] [blame] | 26 | extern bool madvise_free_huge_pmd(struct mmu_gather *tlb, |
Minchan Kim | b8d3c4c | 2016-01-15 16:55:42 -0800 | [diff] [blame] | 27 | struct vm_area_struct *vma, |
| 28 | pmd_t *pmd, unsigned long addr, unsigned long next); |
Andrea Arcangeli | 71e3aac | 2011-01-13 15:46:52 -0800 | [diff] [blame] | 29 | extern int zap_huge_pmd(struct mmu_gather *tlb, |
| 30 | struct vm_area_struct *vma, |
Shaohua Li | f21760b | 2012-01-12 17:19:16 -0800 | [diff] [blame] | 31 | pmd_t *pmd, unsigned long addr); |
Matthew Wilcox | a00cc7d | 2017-02-24 14:57:02 -0800 | [diff] [blame] | 32 | extern int zap_huge_pud(struct mmu_gather *tlb, |
| 33 | struct vm_area_struct *vma, |
| 34 | pud_t *pud, unsigned long addr); |
Johannes Weiner | 0ca1634 | 2011-01-13 15:47:02 -0800 | [diff] [blame] | 35 | extern int mincore_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, |
| 36 | unsigned long addr, unsigned long end, |
| 37 | unsigned char *vec); |
Hugh Dickins | bf8616d | 2016-05-19 17:12:54 -0700 | [diff] [blame] | 38 | extern bool move_huge_pmd(struct vm_area_struct *vma, unsigned long old_addr, |
Andrea Arcangeli | 37a1c49 | 2011-10-31 17:08:30 -0700 | [diff] [blame] | 39 | unsigned long new_addr, unsigned long old_end, |
Aaron Lu | 5d19042 | 2016-11-10 17:16:33 +0800 | [diff] [blame] | 40 | pmd_t *old_pmd, pmd_t *new_pmd, bool *need_flush); |
Johannes Weiner | cd7548a | 2011-01-13 15:47:04 -0800 | [diff] [blame] | 41 | extern int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, |
Mel Gorman | 4b10e7d | 2012-10-25 14:16:32 +0200 | [diff] [blame] | 42 | unsigned long addr, pgprot_t newprot, |
| 43 | int prot_numa); |
Matthew Wilcox | a00cc7d | 2017-02-24 14:57:02 -0800 | [diff] [blame] | 44 | int vmf_insert_pfn_pmd(struct vm_area_struct *vma, unsigned long addr, |
| 45 | pmd_t *pmd, pfn_t pfn, bool write); |
| 46 | int vmf_insert_pfn_pud(struct vm_area_struct *vma, unsigned long addr, |
| 47 | pud_t *pud, pfn_t pfn, bool write); |
Andrea Arcangeli | 71e3aac | 2011-01-13 15:46:52 -0800 | [diff] [blame] | 48 | enum transparent_hugepage_flag { |
| 49 | TRANSPARENT_HUGEPAGE_FLAG, |
| 50 | TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG, |
Mel Gorman | 444eb2a4 | 2016-03-17 14:19:23 -0700 | [diff] [blame] | 51 | TRANSPARENT_HUGEPAGE_DEFRAG_DIRECT_FLAG, |
| 52 | TRANSPARENT_HUGEPAGE_DEFRAG_KSWAPD_FLAG, |
David Rientjes | 21440d7 | 2017-02-22 15:45:49 -0800 | [diff] [blame] | 53 | TRANSPARENT_HUGEPAGE_DEFRAG_KSWAPD_OR_MADV_FLAG, |
Andrea Arcangeli | 71e3aac | 2011-01-13 15:46:52 -0800 | [diff] [blame] | 54 | TRANSPARENT_HUGEPAGE_DEFRAG_REQ_MADV_FLAG, |
Andrea Arcangeli | ba76149 | 2011-01-13 15:46:58 -0800 | [diff] [blame] | 55 | TRANSPARENT_HUGEPAGE_DEFRAG_KHUGEPAGED_FLAG, |
Kirill A. Shutemov | 79da540 | 2012-12-12 13:51:12 -0800 | [diff] [blame] | 56 | TRANSPARENT_HUGEPAGE_USE_ZERO_PAGE_FLAG, |
Andrea Arcangeli | 71e3aac | 2011-01-13 15:46:52 -0800 | [diff] [blame] | 57 | #ifdef CONFIG_DEBUG_VM |
| 58 | TRANSPARENT_HUGEPAGE_DEBUG_COW_FLAG, |
| 59 | #endif |
| 60 | }; |
| 61 | |
Kirill A. Shutemov | b46e756 | 2016-07-26 15:26:24 -0700 | [diff] [blame] | 62 | struct kobject; |
| 63 | struct kobj_attribute; |
| 64 | |
| 65 | extern ssize_t single_hugepage_flag_store(struct kobject *kobj, |
| 66 | struct kobj_attribute *attr, |
| 67 | const char *buf, size_t count, |
| 68 | enum transparent_hugepage_flag flag); |
| 69 | extern ssize_t single_hugepage_flag_show(struct kobject *kobj, |
| 70 | struct kobj_attribute *attr, char *buf, |
| 71 | enum transparent_hugepage_flag flag); |
Kirill A. Shutemov | 5a6e75f | 2016-07-26 15:26:13 -0700 | [diff] [blame] | 72 | extern struct kobj_attribute shmem_enabled_attr; |
| 73 | |
Naoya Horiguchi | d8c37c4 | 2012-03-21 16:34:27 -0700 | [diff] [blame] | 74 | #define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT) |
| 75 | #define HPAGE_PMD_NR (1<<HPAGE_PMD_ORDER) |
| 76 | |
Andrea Arcangeli | 71e3aac | 2011-01-13 15:46:52 -0800 | [diff] [blame] | 77 | #ifdef CONFIG_TRANSPARENT_HUGEPAGE |
Aneesh Kumar K.V | fde5279 | 2013-06-05 17:14:05 -0700 | [diff] [blame] | 78 | #define HPAGE_PMD_SHIFT PMD_SHIFT |
| 79 | #define HPAGE_PMD_SIZE ((1UL) << HPAGE_PMD_SHIFT) |
| 80 | #define HPAGE_PMD_MASK (~(HPAGE_PMD_SIZE - 1)) |
Andrea Arcangeli | 71e3aac | 2011-01-13 15:46:52 -0800 | [diff] [blame] | 81 | |
Matthew Wilcox | a00cc7d | 2017-02-24 14:57:02 -0800 | [diff] [blame] | 82 | #define HPAGE_PUD_SHIFT PUD_SHIFT |
| 83 | #define HPAGE_PUD_SIZE ((1UL) << HPAGE_PUD_SHIFT) |
| 84 | #define HPAGE_PUD_MASK (~(HPAGE_PUD_SIZE - 1)) |
| 85 | |
Alex Shi | 2099597 | 2012-05-29 15:06:31 -0700 | [diff] [blame] | 86 | extern bool is_vma_temporary_stack(struct vm_area_struct *vma); |
| 87 | |
Andrea Arcangeli | 71e3aac | 2011-01-13 15:46:52 -0800 | [diff] [blame] | 88 | #define transparent_hugepage_enabled(__vma) \ |
Andrea Arcangeli | a664b2d | 2011-01-13 15:47:17 -0800 | [diff] [blame] | 89 | ((transparent_hugepage_flags & \ |
| 90 | (1<<TRANSPARENT_HUGEPAGE_FLAG) || \ |
| 91 | (transparent_hugepage_flags & \ |
| 92 | (1<<TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG) && \ |
| 93 | ((__vma)->vm_flags & VM_HUGEPAGE))) && \ |
Andrea Arcangeli | a7d6e4e | 2011-02-15 19:02:45 +0100 | [diff] [blame] | 94 | !((__vma)->vm_flags & VM_NOHUGEPAGE) && \ |
| 95 | !is_vma_temporary_stack(__vma)) |
Kirill A. Shutemov | 79da540 | 2012-12-12 13:51:12 -0800 | [diff] [blame] | 96 | #define transparent_hugepage_use_zero_page() \ |
| 97 | (transparent_hugepage_flags & \ |
| 98 | (1<<TRANSPARENT_HUGEPAGE_USE_ZERO_PAGE_FLAG)) |
Andrea Arcangeli | 71e3aac | 2011-01-13 15:46:52 -0800 | [diff] [blame] | 99 | #ifdef CONFIG_DEBUG_VM |
| 100 | #define transparent_hugepage_debug_cow() \ |
| 101 | (transparent_hugepage_flags & \ |
| 102 | (1<<TRANSPARENT_HUGEPAGE_DEBUG_COW_FLAG)) |
| 103 | #else /* CONFIG_DEBUG_VM */ |
| 104 | #define transparent_hugepage_debug_cow() 0 |
| 105 | #endif /* CONFIG_DEBUG_VM */ |
| 106 | |
| 107 | extern unsigned long transparent_hugepage_flags; |
Kirill A. Shutemov | ad0bed2 | 2016-01-15 16:52:53 -0800 | [diff] [blame] | 108 | |
Toshi Kani | 74d2fad | 2016-10-07 16:59:56 -0700 | [diff] [blame] | 109 | extern unsigned long thp_get_unmapped_area(struct file *filp, |
| 110 | unsigned long addr, unsigned long len, unsigned long pgoff, |
| 111 | unsigned long flags); |
| 112 | |
Kirill A. Shutemov | 9a98225 | 2016-01-15 16:54:17 -0800 | [diff] [blame] | 113 | extern void prep_transhuge_page(struct page *page); |
| 114 | extern void free_transhuge_page(struct page *page); |
| 115 | |
Kirill A. Shutemov | e9b61f1 | 2016-01-15 16:54:10 -0800 | [diff] [blame] | 116 | int split_huge_page_to_list(struct page *page, struct list_head *list); |
| 117 | static inline int split_huge_page(struct page *page) |
| 118 | { |
| 119 | return split_huge_page_to_list(page, NULL); |
| 120 | } |
Kirill A. Shutemov | 9a98225 | 2016-01-15 16:54:17 -0800 | [diff] [blame] | 121 | void deferred_split_huge_page(struct page *page); |
Kirill A. Shutemov | eef1b3b | 2016-01-15 16:53:53 -0800 | [diff] [blame] | 122 | |
| 123 | void __split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, |
Naoya Horiguchi | 33f4751 | 2016-07-14 12:07:32 -0700 | [diff] [blame] | 124 | unsigned long address, bool freeze, struct page *page); |
Kirill A. Shutemov | eef1b3b | 2016-01-15 16:53:53 -0800 | [diff] [blame] | 125 | |
| 126 | #define split_huge_pmd(__vma, __pmd, __address) \ |
| 127 | do { \ |
| 128 | pmd_t *____pmd = (__pmd); \ |
Dan Williams | 5c7fb56 | 2016-01-15 16:56:52 -0800 | [diff] [blame] | 129 | if (pmd_trans_huge(*____pmd) \ |
| 130 | || pmd_devmap(*____pmd)) \ |
Kirill A. Shutemov | fec89c1 | 2016-03-17 14:20:10 -0700 | [diff] [blame] | 131 | __split_huge_pmd(__vma, __pmd, __address, \ |
Naoya Horiguchi | 33f4751 | 2016-07-14 12:07:32 -0700 | [diff] [blame] | 132 | false, NULL); \ |
Kirill A. Shutemov | eef1b3b | 2016-01-15 16:53:53 -0800 | [diff] [blame] | 133 | } while (0) |
Kirill A. Shutemov | ad0bed2 | 2016-01-15 16:52:53 -0800 | [diff] [blame] | 134 | |
Kirill A. Shutemov | 2a52bcb | 2016-03-17 14:20:04 -0700 | [diff] [blame] | 135 | |
Kirill A. Shutemov | fec89c1 | 2016-03-17 14:20:10 -0700 | [diff] [blame] | 136 | void split_huge_pmd_address(struct vm_area_struct *vma, unsigned long address, |
| 137 | bool freeze, struct page *page); |
Kirill A. Shutemov | 2a52bcb | 2016-03-17 14:20:04 -0700 | [diff] [blame] | 138 | |
Matthew Wilcox | a00cc7d | 2017-02-24 14:57:02 -0800 | [diff] [blame] | 139 | void __split_huge_pud(struct vm_area_struct *vma, pud_t *pud, |
| 140 | unsigned long address); |
| 141 | |
| 142 | #define split_huge_pud(__vma, __pud, __address) \ |
| 143 | do { \ |
| 144 | pud_t *____pud = (__pud); \ |
| 145 | if (pud_trans_huge(*____pud) \ |
| 146 | || pud_devmap(*____pud)) \ |
| 147 | __split_huge_pud(__vma, __pud, __address); \ |
| 148 | } while (0) |
| 149 | |
Andrea Arcangeli | 60ab324 | 2011-01-13 15:47:18 -0800 | [diff] [blame] | 150 | extern int hugepage_madvise(struct vm_area_struct *vma, |
| 151 | unsigned long *vm_flags, int advice); |
Kirill A. Shutemov | e1b9996 | 2015-09-08 14:58:37 -0700 | [diff] [blame] | 152 | extern void vma_adjust_trans_huge(struct vm_area_struct *vma, |
Andrea Arcangeli | 94fcc58 | 2011-01-13 15:47:08 -0800 | [diff] [blame] | 153 | unsigned long start, |
| 154 | unsigned long end, |
| 155 | long adjust_next); |
Kirill A. Shutemov | b6ec57f | 2016-01-21 16:40:25 -0800 | [diff] [blame] | 156 | extern spinlock_t *__pmd_trans_huge_lock(pmd_t *pmd, |
| 157 | struct vm_area_struct *vma); |
Matthew Wilcox | a00cc7d | 2017-02-24 14:57:02 -0800 | [diff] [blame] | 158 | extern spinlock_t *__pud_trans_huge_lock(pud_t *pud, |
| 159 | struct vm_area_struct *vma); |
Naoya Horiguchi | 025c5b2 | 2012-03-21 16:33:57 -0700 | [diff] [blame] | 160 | /* mmap_sem must be held on entry */ |
Kirill A. Shutemov | b6ec57f | 2016-01-21 16:40:25 -0800 | [diff] [blame] | 161 | static inline spinlock_t *pmd_trans_huge_lock(pmd_t *pmd, |
| 162 | struct vm_area_struct *vma) |
Naoya Horiguchi | 025c5b2 | 2012-03-21 16:33:57 -0700 | [diff] [blame] | 163 | { |
Sasha Levin | 81d1b09 | 2014-10-09 15:28:10 -0700 | [diff] [blame] | 164 | VM_BUG_ON_VMA(!rwsem_is_locked(&vma->vm_mm->mmap_sem), vma); |
Dan Williams | 5c7fb56 | 2016-01-15 16:56:52 -0800 | [diff] [blame] | 165 | if (pmd_trans_huge(*pmd) || pmd_devmap(*pmd)) |
Kirill A. Shutemov | b6ec57f | 2016-01-21 16:40:25 -0800 | [diff] [blame] | 166 | return __pmd_trans_huge_lock(pmd, vma); |
Naoya Horiguchi | 025c5b2 | 2012-03-21 16:33:57 -0700 | [diff] [blame] | 167 | else |
Chen Gang | 969e8d7 | 2016-04-01 14:31:17 -0700 | [diff] [blame] | 168 | return NULL; |
Naoya Horiguchi | 025c5b2 | 2012-03-21 16:33:57 -0700 | [diff] [blame] | 169 | } |
Matthew Wilcox | a00cc7d | 2017-02-24 14:57:02 -0800 | [diff] [blame] | 170 | static inline spinlock_t *pud_trans_huge_lock(pud_t *pud, |
| 171 | struct vm_area_struct *vma) |
| 172 | { |
| 173 | VM_BUG_ON_VMA(!rwsem_is_locked(&vma->vm_mm->mmap_sem), vma); |
| 174 | if (pud_trans_huge(*pud) || pud_devmap(*pud)) |
| 175 | return __pud_trans_huge_lock(pud, vma); |
| 176 | else |
| 177 | return NULL; |
| 178 | } |
Rik van Riel | 2c888cf | 2011-01-13 15:47:13 -0800 | [diff] [blame] | 179 | static inline int hpage_nr_pages(struct page *page) |
| 180 | { |
| 181 | if (unlikely(PageTransHuge(page))) |
| 182 | return HPAGE_PMD_NR; |
| 183 | return 1; |
| 184 | } |
Mel Gorman | d10e63f | 2012-10-25 14:16:31 +0200 | [diff] [blame] | 185 | |
Matthew Wilcox | a00cc7d | 2017-02-24 14:57:02 -0800 | [diff] [blame] | 186 | struct page *follow_devmap_pmd(struct vm_area_struct *vma, unsigned long addr, |
| 187 | pmd_t *pmd, int flags); |
| 188 | struct page *follow_devmap_pud(struct vm_area_struct *vma, unsigned long addr, |
| 189 | pud_t *pud, int flags); |
| 190 | |
Jan Kara | 82b0f8c | 2016-12-14 15:06:58 -0800 | [diff] [blame] | 191 | extern int do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t orig_pmd); |
Mel Gorman | d10e63f | 2012-10-25 14:16:31 +0200 | [diff] [blame] | 192 | |
Wang, Yalin | 56873f4 | 2015-02-11 15:24:51 -0800 | [diff] [blame] | 193 | extern struct page *huge_zero_page; |
| 194 | |
| 195 | static inline bool is_huge_zero_page(struct page *page) |
| 196 | { |
| 197 | return ACCESS_ONCE(huge_zero_page) == page; |
| 198 | } |
| 199 | |
Matthew Wilcox | fc43704 | 2015-09-08 14:58:51 -0700 | [diff] [blame] | 200 | static inline bool is_huge_zero_pmd(pmd_t pmd) |
| 201 | { |
| 202 | return is_huge_zero_page(pmd_page(pmd)); |
| 203 | } |
| 204 | |
Matthew Wilcox | a00cc7d | 2017-02-24 14:57:02 -0800 | [diff] [blame] | 205 | static inline bool is_huge_zero_pud(pud_t pud) |
| 206 | { |
| 207 | return false; |
| 208 | } |
| 209 | |
Aaron Lu | 6fcb52a | 2016-10-07 17:00:08 -0700 | [diff] [blame] | 210 | struct page *mm_get_huge_zero_page(struct mm_struct *mm); |
| 211 | void mm_put_huge_zero_page(struct mm_struct *mm); |
Matthew Wilcox | fc43704 | 2015-09-08 14:58:51 -0700 | [diff] [blame] | 212 | |
Kirill A. Shutemov | 1010245 | 2016-07-26 15:25:29 -0700 | [diff] [blame] | 213 | #define mk_huge_pmd(page, prot) pmd_mkhuge(mk_pmd(page, prot)) |
| 214 | |
Andrea Arcangeli | 71e3aac | 2011-01-13 15:46:52 -0800 | [diff] [blame] | 215 | #else /* CONFIG_TRANSPARENT_HUGEPAGE */ |
Naoya Horiguchi | d8c37c4 | 2012-03-21 16:34:27 -0700 | [diff] [blame] | 216 | #define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; }) |
| 217 | #define HPAGE_PMD_MASK ({ BUILD_BUG(); 0; }) |
| 218 | #define HPAGE_PMD_SIZE ({ BUILD_BUG(); 0; }) |
Andrea Arcangeli | 71e3aac | 2011-01-13 15:46:52 -0800 | [diff] [blame] | 219 | |
Matthew Wilcox | a00cc7d | 2017-02-24 14:57:02 -0800 | [diff] [blame] | 220 | #define HPAGE_PUD_SHIFT ({ BUILD_BUG(); 0; }) |
| 221 | #define HPAGE_PUD_MASK ({ BUILD_BUG(); 0; }) |
| 222 | #define HPAGE_PUD_SIZE ({ BUILD_BUG(); 0; }) |
| 223 | |
Rik van Riel | 2c888cf | 2011-01-13 15:47:13 -0800 | [diff] [blame] | 224 | #define hpage_nr_pages(x) 1 |
| 225 | |
Andrea Arcangeli | 71e3aac | 2011-01-13 15:46:52 -0800 | [diff] [blame] | 226 | #define transparent_hugepage_enabled(__vma) 0 |
| 227 | |
Kirill A. Shutemov | 800d8c6 | 2016-07-26 15:26:18 -0700 | [diff] [blame] | 228 | static inline void prep_transhuge_page(struct page *page) {} |
| 229 | |
Andrea Arcangeli | 71e3aac | 2011-01-13 15:46:52 -0800 | [diff] [blame] | 230 | #define transparent_hugepage_flags 0UL |
Toshi Kani | 74d2fad | 2016-10-07 16:59:56 -0700 | [diff] [blame] | 231 | |
| 232 | #define thp_get_unmapped_area NULL |
| 233 | |
Shaohua Li | 5bc7b8a | 2013-04-29 15:08:36 -0700 | [diff] [blame] | 234 | static inline int |
| 235 | split_huge_page_to_list(struct page *page, struct list_head *list) |
| 236 | { |
| 237 | return 0; |
| 238 | } |
Andrea Arcangeli | 71e3aac | 2011-01-13 15:46:52 -0800 | [diff] [blame] | 239 | static inline int split_huge_page(struct page *page) |
| 240 | { |
| 241 | return 0; |
| 242 | } |
Kirill A. Shutemov | 9a98225 | 2016-01-15 16:54:17 -0800 | [diff] [blame] | 243 | static inline void deferred_split_huge_page(struct page *page) {} |
Kirill A. Shutemov | 78ddc53 | 2016-01-15 16:52:42 -0800 | [diff] [blame] | 244 | #define split_huge_pmd(__vma, __pmd, __address) \ |
Kirill A. Shutemov | e180377 | 2012-12-12 13:50:59 -0800 | [diff] [blame] | 245 | do { } while (0) |
Kirill A. Shutemov | 2a52bcb | 2016-03-17 14:20:04 -0700 | [diff] [blame] | 246 | |
David Rientjes | fd60775 | 2016-12-12 16:42:20 -0800 | [diff] [blame] | 247 | static inline void __split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, |
| 248 | unsigned long address, bool freeze, struct page *page) {} |
Kirill A. Shutemov | 2a52bcb | 2016-03-17 14:20:04 -0700 | [diff] [blame] | 249 | static inline void split_huge_pmd_address(struct vm_area_struct *vma, |
Kirill A. Shutemov | fec89c1 | 2016-03-17 14:20:10 -0700 | [diff] [blame] | 250 | unsigned long address, bool freeze, struct page *page) {} |
Kirill A. Shutemov | 2a52bcb | 2016-03-17 14:20:04 -0700 | [diff] [blame] | 251 | |
Matthew Wilcox | a00cc7d | 2017-02-24 14:57:02 -0800 | [diff] [blame] | 252 | #define split_huge_pud(__vma, __pmd, __address) \ |
| 253 | do { } while (0) |
| 254 | |
Andrea Arcangeli | 60ab324 | 2011-01-13 15:47:18 -0800 | [diff] [blame] | 255 | static inline int hugepage_madvise(struct vm_area_struct *vma, |
| 256 | unsigned long *vm_flags, int advice) |
Andrea Arcangeli | 0af4e98 | 2011-01-13 15:46:55 -0800 | [diff] [blame] | 257 | { |
| 258 | BUG(); |
| 259 | return 0; |
| 260 | } |
Andrea Arcangeli | 94fcc58 | 2011-01-13 15:47:08 -0800 | [diff] [blame] | 261 | static inline void vma_adjust_trans_huge(struct vm_area_struct *vma, |
| 262 | unsigned long start, |
| 263 | unsigned long end, |
| 264 | long adjust_next) |
| 265 | { |
| 266 | } |
Kirill A. Shutemov | b6ec57f | 2016-01-21 16:40:25 -0800 | [diff] [blame] | 267 | static inline spinlock_t *pmd_trans_huge_lock(pmd_t *pmd, |
| 268 | struct vm_area_struct *vma) |
Naoya Horiguchi | 025c5b2 | 2012-03-21 16:33:57 -0700 | [diff] [blame] | 269 | { |
Kirill A. Shutemov | b6ec57f | 2016-01-21 16:40:25 -0800 | [diff] [blame] | 270 | return NULL; |
Naoya Horiguchi | 025c5b2 | 2012-03-21 16:33:57 -0700 | [diff] [blame] | 271 | } |
Matthew Wilcox | a00cc7d | 2017-02-24 14:57:02 -0800 | [diff] [blame] | 272 | static inline spinlock_t *pud_trans_huge_lock(pud_t *pud, |
| 273 | struct vm_area_struct *vma) |
| 274 | { |
| 275 | return NULL; |
| 276 | } |
Mel Gorman | d10e63f | 2012-10-25 14:16:31 +0200 | [diff] [blame] | 277 | |
Jan Kara | 82b0f8c | 2016-12-14 15:06:58 -0800 | [diff] [blame] | 278 | static inline int do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t orig_pmd) |
Mel Gorman | d10e63f | 2012-10-25 14:16:31 +0200 | [diff] [blame] | 279 | { |
Mel Gorman | 4daae3b | 2012-11-02 11:33:45 +0000 | [diff] [blame] | 280 | return 0; |
Mel Gorman | d10e63f | 2012-10-25 14:16:31 +0200 | [diff] [blame] | 281 | } |
| 282 | |
Wang, Yalin | 56873f4 | 2015-02-11 15:24:51 -0800 | [diff] [blame] | 283 | static inline bool is_huge_zero_page(struct page *page) |
| 284 | { |
| 285 | return false; |
| 286 | } |
| 287 | |
Matthew Wilcox | a00cc7d | 2017-02-24 14:57:02 -0800 | [diff] [blame] | 288 | static inline bool is_huge_zero_pud(pud_t pud) |
| 289 | { |
| 290 | return false; |
| 291 | } |
| 292 | |
Aaron Lu | 6fcb52a | 2016-10-07 17:00:08 -0700 | [diff] [blame] | 293 | static inline void mm_put_huge_zero_page(struct mm_struct *mm) |
Kirill A. Shutemov | aa88b68 | 2016-04-28 16:18:27 -0700 | [diff] [blame] | 294 | { |
Aaron Lu | 6fcb52a | 2016-10-07 17:00:08 -0700 | [diff] [blame] | 295 | return; |
Kirill A. Shutemov | aa88b68 | 2016-04-28 16:18:27 -0700 | [diff] [blame] | 296 | } |
Dan Williams | 3565fce | 2016-01-15 16:56:55 -0800 | [diff] [blame] | 297 | |
| 298 | static inline struct page *follow_devmap_pmd(struct vm_area_struct *vma, |
| 299 | unsigned long addr, pmd_t *pmd, int flags) |
| 300 | { |
| 301 | return NULL; |
| 302 | } |
Matthew Wilcox | a00cc7d | 2017-02-24 14:57:02 -0800 | [diff] [blame] | 303 | |
| 304 | static inline struct page *follow_devmap_pud(struct vm_area_struct *vma, |
| 305 | unsigned long addr, pud_t *pud, int flags) |
| 306 | { |
| 307 | return NULL; |
| 308 | } |
Andrea Arcangeli | 71e3aac | 2011-01-13 15:46:52 -0800 | [diff] [blame] | 309 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE */ |
| 310 | |
| 311 | #endif /* _LINUX_HUGE_MM_H */ |