1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_KHUGEPAGED_H
3 #define _LINUX_KHUGEPAGED_H
5 #include <linux/sched/coredump.h> /* MMF_VM_HUGEPAGE */
7 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
8 extern struct attribute_group khugepaged_attr_group;
10 extern int khugepaged_init(void);
11 extern void khugepaged_destroy(void);
12 extern int start_stop_khugepaged(void);
13 extern void __khugepaged_enter(struct mm_struct *mm);
14 extern void __khugepaged_exit(struct mm_struct *mm);
15 extern void khugepaged_enter_vma(struct vm_area_struct *vma,
16 unsigned long vm_flags);
17 extern void khugepaged_min_free_kbytes_update(void);
19 extern void collapse_pte_mapped_thp(struct mm_struct *mm, unsigned long addr);
21 static inline void collapse_pte_mapped_thp(struct mm_struct *mm,
27 static inline void khugepaged_fork(struct mm_struct *mm, struct mm_struct *oldmm)
29 if (test_bit(MMF_VM_HUGEPAGE, &oldmm->flags))
30 __khugepaged_enter(mm);
33 static inline void khugepaged_exit(struct mm_struct *mm)
35 if (test_bit(MMF_VM_HUGEPAGE, &mm->flags))
36 __khugepaged_exit(mm);
38 #else /* CONFIG_TRANSPARENT_HUGEPAGE */
39 static inline void khugepaged_fork(struct mm_struct *mm, struct mm_struct *oldmm)
42 static inline void khugepaged_exit(struct mm_struct *mm)
45 static inline void khugepaged_enter_vma(struct vm_area_struct *vma,
46 unsigned long vm_flags)
49 static inline void collapse_pte_mapped_thp(struct mm_struct *mm,
54 static inline void khugepaged_min_free_kbytes_update(void)
57 #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
59 #endif /* _LINUX_KHUGEPAGED_H */