1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_KHUGEPAGED_H
3 #define _LINUX_KHUGEPAGED_H
5 extern unsigned int khugepaged_max_ptes_none __read_mostly
;
6 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
7 extern struct attribute_group khugepaged_attr_group
;
9 extern int khugepaged_init(void);
10 extern void khugepaged_destroy(void);
11 extern int start_stop_khugepaged(void);
12 extern void __khugepaged_enter(struct mm_struct
*mm
);
13 extern void __khugepaged_exit(struct mm_struct
*mm
);
14 extern void khugepaged_enter_vma(struct vm_area_struct
*vma
,
15 unsigned long vm_flags
);
16 extern void khugepaged_min_free_kbytes_update(void);
17 extern bool current_is_khugepaged(void);
19 extern int collapse_pte_mapped_thp(struct mm_struct
*mm
, unsigned long addr
,
22 static inline int collapse_pte_mapped_thp(struct mm_struct
*mm
,
23 unsigned long addr
, bool install_pmd
)
29 static inline void khugepaged_fork(struct mm_struct
*mm
, struct mm_struct
*oldmm
)
31 if (test_bit(MMF_VM_HUGEPAGE
, &oldmm
->flags
))
32 __khugepaged_enter(mm
);
35 static inline void khugepaged_exit(struct mm_struct
*mm
)
37 if (test_bit(MMF_VM_HUGEPAGE
, &mm
->flags
))
38 __khugepaged_exit(mm
);
40 #else /* CONFIG_TRANSPARENT_HUGEPAGE */
41 static inline void khugepaged_fork(struct mm_struct
*mm
, struct mm_struct
*oldmm
)
44 static inline void khugepaged_exit(struct mm_struct
*mm
)
47 static inline void khugepaged_enter_vma(struct vm_area_struct
*vma
,
48 unsigned long vm_flags
)
51 static inline int collapse_pte_mapped_thp(struct mm_struct
*mm
,
52 unsigned long addr
, bool install_pmd
)
57 static inline void khugepaged_min_free_kbytes_update(void)
61 static inline bool current_is_khugepaged(void)
65 #endif /* CONFIG_TRANSPARENT_HUGEPAGE */
67 #endif /* _LINUX_KHUGEPAGED_H */