0001
0002 #ifndef _LINUX_KHUGEPAGED_H
0003 #define _LINUX_KHUGEPAGED_H
0004
0005 #include <linux/sched/coredump.h> /* MMF_VM_HUGEPAGE */
0006
0007 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
0008 extern struct attribute_group khugepaged_attr_group;
0009
0010 extern int khugepaged_init(void);
0011 extern void khugepaged_destroy(void);
0012 extern int start_stop_khugepaged(void);
0013 extern void __khugepaged_enter(struct mm_struct *mm);
0014 extern void __khugepaged_exit(struct mm_struct *mm);
0015 extern void khugepaged_enter_vma(struct vm_area_struct *vma,
0016 unsigned long vm_flags);
0017 extern void khugepaged_min_free_kbytes_update(void);
0018 #ifdef CONFIG_SHMEM
0019 extern void collapse_pte_mapped_thp(struct mm_struct *mm, unsigned long addr);
0020 #else
0021 static inline void collapse_pte_mapped_thp(struct mm_struct *mm,
0022 unsigned long addr)
0023 {
0024 }
0025 #endif
0026
0027 static inline void khugepaged_fork(struct mm_struct *mm, struct mm_struct *oldmm)
0028 {
0029 if (test_bit(MMF_VM_HUGEPAGE, &oldmm->flags))
0030 __khugepaged_enter(mm);
0031 }
0032
0033 static inline void khugepaged_exit(struct mm_struct *mm)
0034 {
0035 if (test_bit(MMF_VM_HUGEPAGE, &mm->flags))
0036 __khugepaged_exit(mm);
0037 }
0038 #else
0039 static inline void khugepaged_fork(struct mm_struct *mm, struct mm_struct *oldmm)
0040 {
0041 }
0042 static inline void khugepaged_exit(struct mm_struct *mm)
0043 {
0044 }
0045 static inline void khugepaged_enter_vma(struct vm_area_struct *vma,
0046 unsigned long vm_flags)
0047 {
0048 }
0049 static inline void collapse_pte_mapped_thp(struct mm_struct *mm,
0050 unsigned long addr)
0051 {
0052 }
0053
0054 static inline void khugepaged_min_free_kbytes_update(void)
0055 {
0056 }
0057 #endif
0058
0059 #endif