blob: 45ede62aa85be47370719dae4004c88ec1796e06 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Andrea Arcangeli71e3aac2011-01-13 15:46:52 -08002#ifndef _LINUX_HUGE_MM_H
3#define _LINUX_HUGE_MM_H
4
Dan Williams16981d72017-07-10 15:48:22 -07005#include <linux/sched/coredump.h>
Dan Williams226ab562018-07-13 21:49:34 -07006#include <linux/mm_types.h>
Dan Williams16981d72017-07-10 15:48:22 -07007
Dan Williamsbaabda22017-07-10 15:48:25 -07008#include <linux/fs.h> /* only for vma_is_dax() */
9
Souptick Joarder2b740302018-08-23 17:01:36 -070010extern vm_fault_t do_huge_pmd_anonymous_page(struct vm_fault *vmf);
Andrea Arcangeli71e3aac2011-01-13 15:46:52 -080011extern int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm,
12 pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr,
13 struct vm_area_struct *vma);
Jan Kara82b0f8c2016-12-14 15:06:58 -080014extern void huge_pmd_set_accessed(struct vm_fault *vmf, pmd_t orig_pmd);
Matthew Wilcoxa00cc7d2017-02-24 14:57:02 -080015extern int copy_huge_pud(struct mm_struct *dst_mm, struct mm_struct *src_mm,
16 pud_t *dst_pud, pud_t *src_pud, unsigned long addr,
17 struct vm_area_struct *vma);
18
19#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD
20extern void huge_pud_set_accessed(struct vm_fault *vmf, pud_t orig_pud);
21#else
22static inline void huge_pud_set_accessed(struct vm_fault *vmf, pud_t orig_pud)
23{
24}
25#endif
26
Souptick Joarder2b740302018-08-23 17:01:36 -070027extern vm_fault_t do_huge_pmd_wp_page(struct vm_fault *vmf, pmd_t orig_pmd);
David Rientjesb676b292012-10-08 16:34:03 -070028extern struct page *follow_trans_huge_pmd(struct vm_area_struct *vma,
Andrea Arcangeli71e3aac2011-01-13 15:46:52 -080029 unsigned long addr,
30 pmd_t *pmd,
31 unsigned int flags);
Huang Ying319904a2016-07-28 15:48:03 -070032extern bool madvise_free_huge_pmd(struct mmu_gather *tlb,
Minchan Kimb8d3c4c2016-01-15 16:55:42 -080033 struct vm_area_struct *vma,
34 pmd_t *pmd, unsigned long addr, unsigned long next);
Andrea Arcangeli71e3aac2011-01-13 15:46:52 -080035extern int zap_huge_pmd(struct mmu_gather *tlb,
36 struct vm_area_struct *vma,
Shaohua Lif21760b2012-01-12 17:19:16 -080037 pmd_t *pmd, unsigned long addr);
Matthew Wilcoxa00cc7d2017-02-24 14:57:02 -080038extern int zap_huge_pud(struct mmu_gather *tlb,
39 struct vm_area_struct *vma,
40 pud_t *pud, unsigned long addr);
Johannes Weiner0ca16342011-01-13 15:47:02 -080041extern int mincore_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
42 unsigned long addr, unsigned long end,
43 unsigned char *vec);
Hugh Dickinsbf8616d2016-05-19 17:12:54 -070044extern bool move_huge_pmd(struct vm_area_struct *vma, unsigned long old_addr,
Andrea Arcangeli37a1c492011-10-31 17:08:30 -070045 unsigned long new_addr, unsigned long old_end,
Linus Torvaldseb66ae02018-10-12 15:22:59 -070046 pmd_t *old_pmd, pmd_t *new_pmd);
Johannes Weinercd7548a2011-01-13 15:47:04 -080047extern int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
Mel Gorman4b10e7d2012-10-25 14:16:32 +020048 unsigned long addr, pgprot_t newprot,
49 int prot_numa);
Dan Williamsfce86ff2019-05-13 17:15:33 -070050vm_fault_t vmf_insert_pfn_pmd(struct vm_fault *vmf, pfn_t pfn, bool write);
51vm_fault_t vmf_insert_pfn_pud(struct vm_fault *vmf, pfn_t pfn, bool write);
Andrea Arcangeli71e3aac2011-01-13 15:46:52 -080052enum transparent_hugepage_flag {
53 TRANSPARENT_HUGEPAGE_FLAG,
54 TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG,
Mel Gorman444eb2a42016-03-17 14:19:23 -070055 TRANSPARENT_HUGEPAGE_DEFRAG_DIRECT_FLAG,
56 TRANSPARENT_HUGEPAGE_DEFRAG_KSWAPD_FLAG,
David Rientjes21440d72017-02-22 15:45:49 -080057 TRANSPARENT_HUGEPAGE_DEFRAG_KSWAPD_OR_MADV_FLAG,
Andrea Arcangeli71e3aac2011-01-13 15:46:52 -080058 TRANSPARENT_HUGEPAGE_DEFRAG_REQ_MADV_FLAG,
Andrea Arcangeliba761492011-01-13 15:46:58 -080059 TRANSPARENT_HUGEPAGE_DEFRAG_KHUGEPAGED_FLAG,
Kirill A. Shutemov79da5402012-12-12 13:51:12 -080060 TRANSPARENT_HUGEPAGE_USE_ZERO_PAGE_FLAG,
Andrea Arcangeli71e3aac2011-01-13 15:46:52 -080061#ifdef CONFIG_DEBUG_VM
62 TRANSPARENT_HUGEPAGE_DEBUG_COW_FLAG,
63#endif
64};
65
Kirill A. Shutemovb46e7562016-07-26 15:26:24 -070066struct kobject;
67struct kobj_attribute;
68
69extern ssize_t single_hugepage_flag_store(struct kobject *kobj,
70 struct kobj_attribute *attr,
71 const char *buf, size_t count,
72 enum transparent_hugepage_flag flag);
73extern ssize_t single_hugepage_flag_show(struct kobject *kobj,
74 struct kobj_attribute *attr, char *buf,
75 enum transparent_hugepage_flag flag);
Kirill A. Shutemov5a6e75f2016-07-26 15:26:13 -070076extern struct kobj_attribute shmem_enabled_attr;
77
Naoya Horiguchid8c37c42012-03-21 16:34:27 -070078#define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT)
79#define HPAGE_PMD_NR (1<<HPAGE_PMD_ORDER)
80
Andrea Arcangeli71e3aac2011-01-13 15:46:52 -080081#ifdef CONFIG_TRANSPARENT_HUGEPAGE
Aneesh Kumar K.Vfde52792013-06-05 17:14:05 -070082#define HPAGE_PMD_SHIFT PMD_SHIFT
83#define HPAGE_PMD_SIZE ((1UL) << HPAGE_PMD_SHIFT)
84#define HPAGE_PMD_MASK (~(HPAGE_PMD_SIZE - 1))
Andrea Arcangeli71e3aac2011-01-13 15:46:52 -080085
Matthew Wilcoxa00cc7d2017-02-24 14:57:02 -080086#define HPAGE_PUD_SHIFT PUD_SHIFT
87#define HPAGE_PUD_SIZE ((1UL) << HPAGE_PUD_SHIFT)
88#define HPAGE_PUD_MASK (~(HPAGE_PUD_SIZE - 1))
89
Alex Shi20995972012-05-29 15:06:31 -070090extern bool is_vma_temporary_stack(struct vm_area_struct *vma);
91
Dan Williams16981d72017-07-10 15:48:22 -070092extern unsigned long transparent_hugepage_flags;
93
Michal Hocko7635d9c2018-12-28 00:38:21 -080094/*
95 * to be used on vmas which are known to support THP.
96 * Use transparent_hugepage_enabled otherwise
97 */
98static inline bool __transparent_hugepage_enabled(struct vm_area_struct *vma)
Dan Williams16981d72017-07-10 15:48:22 -070099{
100 if (vma->vm_flags & VM_NOHUGEPAGE)
101 return false;
102
103 if (is_vma_temporary_stack(vma))
104 return false;
105
106 if (test_bit(MMF_DISABLE_THP, &vma->vm_mm->flags))
107 return false;
108
109 if (transparent_hugepage_flags & (1 << TRANSPARENT_HUGEPAGE_FLAG))
110 return true;
111
Dan Williamsbaabda22017-07-10 15:48:25 -0700112 if (vma_is_dax(vma))
113 return true;
114
Dan Williams16981d72017-07-10 15:48:22 -0700115 if (transparent_hugepage_flags &
116 (1 << TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG))
117 return !!(vma->vm_flags & VM_HUGEPAGE);
118
119 return false;
120}
121
Michal Hocko7635d9c2018-12-28 00:38:21 -0800122bool transparent_hugepage_enabled(struct vm_area_struct *vma);
123
Yang Shi43675e62019-07-18 15:57:24 -0700124#define HPAGE_CACHE_INDEX_MASK (HPAGE_PMD_NR - 1)
125
126static inline bool transhuge_vma_suitable(struct vm_area_struct *vma,
127 unsigned long haddr)
128{
129 /* Don't have to check pgoff for anonymous vma */
130 if (!vma_is_anonymous(vma)) {
131 if (((vma->vm_start >> PAGE_SHIFT) & HPAGE_CACHE_INDEX_MASK) !=
132 (vma->vm_pgoff & HPAGE_CACHE_INDEX_MASK))
133 return false;
134 }
135
136 if (haddr < vma->vm_start || haddr + HPAGE_PMD_SIZE > vma->vm_end)
137 return false;
138 return true;
139}
140
Kirill A. Shutemov79da5402012-12-12 13:51:12 -0800141#define transparent_hugepage_use_zero_page() \
142 (transparent_hugepage_flags & \
143 (1<<TRANSPARENT_HUGEPAGE_USE_ZERO_PAGE_FLAG))
Andrea Arcangeli71e3aac2011-01-13 15:46:52 -0800144#ifdef CONFIG_DEBUG_VM
145#define transparent_hugepage_debug_cow() \
146 (transparent_hugepage_flags & \
147 (1<<TRANSPARENT_HUGEPAGE_DEBUG_COW_FLAG))
148#else /* CONFIG_DEBUG_VM */
149#define transparent_hugepage_debug_cow() 0
150#endif /* CONFIG_DEBUG_VM */
151
Toshi Kani74d2fad2016-10-07 16:59:56 -0700152extern unsigned long thp_get_unmapped_area(struct file *filp,
153 unsigned long addr, unsigned long len, unsigned long pgoff,
154 unsigned long flags);
155
Kirill A. Shutemov9a982252016-01-15 16:54:17 -0800156extern void prep_transhuge_page(struct page *page);
157extern void free_transhuge_page(struct page *page);
158
Huang Yingb8f593c2017-07-06 15:37:28 -0700159bool can_split_huge_page(struct page *page, int *pextra_pins);
Kirill A. Shutemove9b61f12016-01-15 16:54:10 -0800160int split_huge_page_to_list(struct page *page, struct list_head *list);
161static inline int split_huge_page(struct page *page)
162{
163 return split_huge_page_to_list(page, NULL);
164}
Kirill A. Shutemov9a982252016-01-15 16:54:17 -0800165void deferred_split_huge_page(struct page *page);
Kirill A. Shutemoveef1b3b2016-01-15 16:53:53 -0800166
167void __split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
Naoya Horiguchi33f47512016-07-14 12:07:32 -0700168 unsigned long address, bool freeze, struct page *page);
Kirill A. Shutemoveef1b3b2016-01-15 16:53:53 -0800169
170#define split_huge_pmd(__vma, __pmd, __address) \
171 do { \
172 pmd_t *____pmd = (__pmd); \
Zi Yan84c3fc42017-09-08 16:11:01 -0700173 if (is_swap_pmd(*____pmd) || pmd_trans_huge(*____pmd) \
Dan Williams5c7fb562016-01-15 16:56:52 -0800174 || pmd_devmap(*____pmd)) \
Kirill A. Shutemovfec89c12016-03-17 14:20:10 -0700175 __split_huge_pmd(__vma, __pmd, __address, \
Naoya Horiguchi33f47512016-07-14 12:07:32 -0700176 false, NULL); \
Kirill A. Shutemoveef1b3b2016-01-15 16:53:53 -0800177 } while (0)
Kirill A. Shutemovad0bed22016-01-15 16:52:53 -0800178
Kirill A. Shutemov2a52bcb2016-03-17 14:20:04 -0700179
Kirill A. Shutemovfec89c12016-03-17 14:20:10 -0700180void split_huge_pmd_address(struct vm_area_struct *vma, unsigned long address,
181 bool freeze, struct page *page);
Kirill A. Shutemov2a52bcb2016-03-17 14:20:04 -0700182
Matthew Wilcoxa00cc7d2017-02-24 14:57:02 -0800183void __split_huge_pud(struct vm_area_struct *vma, pud_t *pud,
184 unsigned long address);
185
186#define split_huge_pud(__vma, __pud, __address) \
187 do { \
188 pud_t *____pud = (__pud); \
189 if (pud_trans_huge(*____pud) \
190 || pud_devmap(*____pud)) \
191 __split_huge_pud(__vma, __pud, __address); \
192 } while (0)
193
Andrea Arcangeli60ab3242011-01-13 15:47:18 -0800194extern int hugepage_madvise(struct vm_area_struct *vma,
195 unsigned long *vm_flags, int advice);
Kirill A. Shutemove1b99962015-09-08 14:58:37 -0700196extern void vma_adjust_trans_huge(struct vm_area_struct *vma,
Andrea Arcangeli94fcc582011-01-13 15:47:08 -0800197 unsigned long start,
198 unsigned long end,
199 long adjust_next);
Kirill A. Shutemovb6ec57f2016-01-21 16:40:25 -0800200extern spinlock_t *__pmd_trans_huge_lock(pmd_t *pmd,
201 struct vm_area_struct *vma);
Matthew Wilcoxa00cc7d2017-02-24 14:57:02 -0800202extern spinlock_t *__pud_trans_huge_lock(pud_t *pud,
203 struct vm_area_struct *vma);
Zi Yan84c3fc42017-09-08 16:11:01 -0700204
205static inline int is_swap_pmd(pmd_t pmd)
206{
207 return !pmd_none(pmd) && !pmd_present(pmd);
208}
209
Naoya Horiguchi025c5b22012-03-21 16:33:57 -0700210/* mmap_sem must be held on entry */
Kirill A. Shutemovb6ec57f2016-01-21 16:40:25 -0800211static inline spinlock_t *pmd_trans_huge_lock(pmd_t *pmd,
212 struct vm_area_struct *vma)
Naoya Horiguchi025c5b22012-03-21 16:33:57 -0700213{
Sasha Levin81d1b092014-10-09 15:28:10 -0700214 VM_BUG_ON_VMA(!rwsem_is_locked(&vma->vm_mm->mmap_sem), vma);
Zi Yan84c3fc42017-09-08 16:11:01 -0700215 if (is_swap_pmd(*pmd) || pmd_trans_huge(*pmd) || pmd_devmap(*pmd))
Kirill A. Shutemovb6ec57f2016-01-21 16:40:25 -0800216 return __pmd_trans_huge_lock(pmd, vma);
Naoya Horiguchi025c5b22012-03-21 16:33:57 -0700217 else
Chen Gang969e8d72016-04-01 14:31:17 -0700218 return NULL;
Naoya Horiguchi025c5b22012-03-21 16:33:57 -0700219}
Matthew Wilcoxa00cc7d2017-02-24 14:57:02 -0800220static inline spinlock_t *pud_trans_huge_lock(pud_t *pud,
221 struct vm_area_struct *vma)
222{
223 VM_BUG_ON_VMA(!rwsem_is_locked(&vma->vm_mm->mmap_sem), vma);
224 if (pud_trans_huge(*pud) || pud_devmap(*pud))
225 return __pud_trans_huge_lock(pud, vma);
226 else
227 return NULL;
228}
Rik van Riel2c888cf2011-01-13 15:47:13 -0800229static inline int hpage_nr_pages(struct page *page)
230{
231 if (unlikely(PageTransHuge(page)))
232 return HPAGE_PMD_NR;
233 return 1;
234}
Mel Gormand10e63f2012-10-25 14:16:31 +0200235
Matthew Wilcoxa00cc7d2017-02-24 14:57:02 -0800236struct page *follow_devmap_pmd(struct vm_area_struct *vma, unsigned long addr,
Keith Buschdf06b372018-10-26 15:10:28 -0700237 pmd_t *pmd, int flags, struct dev_pagemap **pgmap);
Matthew Wilcoxa00cc7d2017-02-24 14:57:02 -0800238struct page *follow_devmap_pud(struct vm_area_struct *vma, unsigned long addr,
Keith Buschdf06b372018-10-26 15:10:28 -0700239 pud_t *pud, int flags, struct dev_pagemap **pgmap);
Matthew Wilcoxa00cc7d2017-02-24 14:57:02 -0800240
Souptick Joarder2b740302018-08-23 17:01:36 -0700241extern vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t orig_pmd);
Mel Gormand10e63f2012-10-25 14:16:31 +0200242
Wang, Yalin56873f42015-02-11 15:24:51 -0800243extern struct page *huge_zero_page;
244
245static inline bool is_huge_zero_page(struct page *page)
246{
Mark Rutland6aa7de02017-10-23 14:07:29 -0700247 return READ_ONCE(huge_zero_page) == page;
Wang, Yalin56873f42015-02-11 15:24:51 -0800248}
249
Matthew Wilcoxfc437042015-09-08 14:58:51 -0700250static inline bool is_huge_zero_pmd(pmd_t pmd)
251{
252 return is_huge_zero_page(pmd_page(pmd));
253}
254
Matthew Wilcoxa00cc7d2017-02-24 14:57:02 -0800255static inline bool is_huge_zero_pud(pud_t pud)
256{
257 return false;
258}
259
Aaron Lu6fcb52a2016-10-07 17:00:08 -0700260struct page *mm_get_huge_zero_page(struct mm_struct *mm);
261void mm_put_huge_zero_page(struct mm_struct *mm);
Matthew Wilcoxfc437042015-09-08 14:58:51 -0700262
Kirill A. Shutemov10102452016-07-26 15:25:29 -0700263#define mk_huge_pmd(page, prot) pmd_mkhuge(mk_pmd(page, prot))
264
Naoya Horiguchi9c670ea2017-09-08 16:10:53 -0700265static inline bool thp_migration_supported(void)
266{
267 return IS_ENABLED(CONFIG_ARCH_ENABLE_THP_MIGRATION);
268}
269
Andrea Arcangeli71e3aac2011-01-13 15:46:52 -0800270#else /* CONFIG_TRANSPARENT_HUGEPAGE */
Naoya Horiguchid8c37c42012-03-21 16:34:27 -0700271#define HPAGE_PMD_SHIFT ({ BUILD_BUG(); 0; })
272#define HPAGE_PMD_MASK ({ BUILD_BUG(); 0; })
273#define HPAGE_PMD_SIZE ({ BUILD_BUG(); 0; })
Andrea Arcangeli71e3aac2011-01-13 15:46:52 -0800274
Matthew Wilcoxa00cc7d2017-02-24 14:57:02 -0800275#define HPAGE_PUD_SHIFT ({ BUILD_BUG(); 0; })
276#define HPAGE_PUD_MASK ({ BUILD_BUG(); 0; })
277#define HPAGE_PUD_SIZE ({ BUILD_BUG(); 0; })
278
Rik van Riel2c888cf2011-01-13 15:47:13 -0800279#define hpage_nr_pages(x) 1
280
Michal Hocko7635d9c2018-12-28 00:38:21 -0800281static inline bool __transparent_hugepage_enabled(struct vm_area_struct *vma)
282{
283 return false;
284}
285
Dan Williams16981d72017-07-10 15:48:22 -0700286static inline bool transparent_hugepage_enabled(struct vm_area_struct *vma)
287{
288 return false;
289}
Andrea Arcangeli71e3aac2011-01-13 15:46:52 -0800290
Yang Shi43675e62019-07-18 15:57:24 -0700291static inline bool transhuge_vma_suitable(struct vm_area_struct *vma,
292 unsigned long haddr)
293{
294 return false;
295}
296
Kirill A. Shutemov800d8c62016-07-26 15:26:18 -0700297static inline void prep_transhuge_page(struct page *page) {}
298
Andrea Arcangeli71e3aac2011-01-13 15:46:52 -0800299#define transparent_hugepage_flags 0UL
Toshi Kani74d2fad2016-10-07 16:59:56 -0700300
301#define thp_get_unmapped_area NULL
302
Huang Yingb8f593c2017-07-06 15:37:28 -0700303static inline bool
304can_split_huge_page(struct page *page, int *pextra_pins)
305{
306 BUILD_BUG();
307 return false;
308}
Shaohua Li5bc7b8a2013-04-29 15:08:36 -0700309static inline int
310split_huge_page_to_list(struct page *page, struct list_head *list)
311{
312 return 0;
313}
Andrea Arcangeli71e3aac2011-01-13 15:46:52 -0800314static inline int split_huge_page(struct page *page)
315{
316 return 0;
317}
Kirill A. Shutemov9a982252016-01-15 16:54:17 -0800318static inline void deferred_split_huge_page(struct page *page) {}
Kirill A. Shutemov78ddc532016-01-15 16:52:42 -0800319#define split_huge_pmd(__vma, __pmd, __address) \
Kirill A. Shutemove1803772012-12-12 13:50:59 -0800320 do { } while (0)
Kirill A. Shutemov2a52bcb2016-03-17 14:20:04 -0700321
David Rientjesfd607752016-12-12 16:42:20 -0800322static inline void __split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
323 unsigned long address, bool freeze, struct page *page) {}
Kirill A. Shutemov2a52bcb2016-03-17 14:20:04 -0700324static inline void split_huge_pmd_address(struct vm_area_struct *vma,
Kirill A. Shutemovfec89c12016-03-17 14:20:10 -0700325 unsigned long address, bool freeze, struct page *page) {}
Kirill A. Shutemov2a52bcb2016-03-17 14:20:04 -0700326
Matthew Wilcoxa00cc7d2017-02-24 14:57:02 -0800327#define split_huge_pud(__vma, __pmd, __address) \
328 do { } while (0)
329
Andrea Arcangeli60ab3242011-01-13 15:47:18 -0800330static inline int hugepage_madvise(struct vm_area_struct *vma,
331 unsigned long *vm_flags, int advice)
Andrea Arcangeli0af4e982011-01-13 15:46:55 -0800332{
333 BUG();
334 return 0;
335}
Andrea Arcangeli94fcc582011-01-13 15:47:08 -0800336static inline void vma_adjust_trans_huge(struct vm_area_struct *vma,
337 unsigned long start,
338 unsigned long end,
339 long adjust_next)
340{
341}
Zi Yan84c3fc42017-09-08 16:11:01 -0700342static inline int is_swap_pmd(pmd_t pmd)
343{
344 return 0;
345}
Kirill A. Shutemovb6ec57f2016-01-21 16:40:25 -0800346static inline spinlock_t *pmd_trans_huge_lock(pmd_t *pmd,
347 struct vm_area_struct *vma)
Naoya Horiguchi025c5b22012-03-21 16:33:57 -0700348{
Kirill A. Shutemovb6ec57f2016-01-21 16:40:25 -0800349 return NULL;
Naoya Horiguchi025c5b22012-03-21 16:33:57 -0700350}
Matthew Wilcoxa00cc7d2017-02-24 14:57:02 -0800351static inline spinlock_t *pud_trans_huge_lock(pud_t *pud,
352 struct vm_area_struct *vma)
353{
354 return NULL;
355}
Mel Gormand10e63f2012-10-25 14:16:31 +0200356
Souptick Joarder2b740302018-08-23 17:01:36 -0700357static inline vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf,
358 pmd_t orig_pmd)
Mel Gormand10e63f2012-10-25 14:16:31 +0200359{
Mel Gorman4daae3b2012-11-02 11:33:45 +0000360 return 0;
Mel Gormand10e63f2012-10-25 14:16:31 +0200361}
362
Wang, Yalin56873f42015-02-11 15:24:51 -0800363static inline bool is_huge_zero_page(struct page *page)
364{
365 return false;
366}
367
Matthew Wilcoxa00cc7d2017-02-24 14:57:02 -0800368static inline bool is_huge_zero_pud(pud_t pud)
369{
370 return false;
371}
372
Aaron Lu6fcb52a2016-10-07 17:00:08 -0700373static inline void mm_put_huge_zero_page(struct mm_struct *mm)
Kirill A. Shutemovaa88b682016-04-28 16:18:27 -0700374{
Aaron Lu6fcb52a2016-10-07 17:00:08 -0700375 return;
Kirill A. Shutemovaa88b682016-04-28 16:18:27 -0700376}
Dan Williams3565fce2016-01-15 16:56:55 -0800377
378static inline struct page *follow_devmap_pmd(struct vm_area_struct *vma,
Keith Buschdf06b372018-10-26 15:10:28 -0700379 unsigned long addr, pmd_t *pmd, int flags, struct dev_pagemap **pgmap)
Dan Williams3565fce2016-01-15 16:56:55 -0800380{
381 return NULL;
382}
Matthew Wilcoxa00cc7d2017-02-24 14:57:02 -0800383
384static inline struct page *follow_devmap_pud(struct vm_area_struct *vma,
Keith Buschdf06b372018-10-26 15:10:28 -0700385 unsigned long addr, pud_t *pud, int flags, struct dev_pagemap **pgmap)
Matthew Wilcoxa00cc7d2017-02-24 14:57:02 -0800386{
387 return NULL;
388}
Naoya Horiguchi9c670ea2017-09-08 16:10:53 -0700389
390static inline bool thp_migration_supported(void)
391{
392 return false;
393}
Andrea Arcangeli71e3aac2011-01-13 15:46:52 -0800394#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
395
396#endif /* _LINUX_HUGE_MM_H */