Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
at v6.12 69 lines 1.9 kB view raw
1/* SPDX-License-Identifier: GPL-2.0 */ 2#ifndef _LINUX_KHUGEPAGED_H 3#define _LINUX_KHUGEPAGED_H 4 5#include <linux/sched/coredump.h> /* MMF_VM_HUGEPAGE */ 6 7extern unsigned int khugepaged_max_ptes_none __read_mostly; 8#ifdef CONFIG_TRANSPARENT_HUGEPAGE 9extern struct attribute_group khugepaged_attr_group; 10 11extern int khugepaged_init(void); 12extern void khugepaged_destroy(void); 13extern int start_stop_khugepaged(void); 14extern void __khugepaged_enter(struct mm_struct *mm); 15extern void __khugepaged_exit(struct mm_struct *mm); 16extern void khugepaged_enter_vma(struct vm_area_struct *vma, 17 unsigned long vm_flags); 18extern void khugepaged_min_free_kbytes_update(void); 19extern bool current_is_khugepaged(void); 20#ifdef CONFIG_SHMEM 21extern int collapse_pte_mapped_thp(struct mm_struct *mm, unsigned long addr, 22 bool install_pmd); 23#else 24static inline int collapse_pte_mapped_thp(struct mm_struct *mm, 25 unsigned long addr, bool install_pmd) 26{ 27 return 0; 28} 29#endif 30 31static inline void khugepaged_fork(struct mm_struct *mm, struct mm_struct *oldmm) 32{ 33 if (test_bit(MMF_VM_HUGEPAGE, &oldmm->flags)) 34 __khugepaged_enter(mm); 35} 36 37static inline void khugepaged_exit(struct mm_struct *mm) 38{ 39 if (test_bit(MMF_VM_HUGEPAGE, &mm->flags)) 40 __khugepaged_exit(mm); 41} 42#else /* CONFIG_TRANSPARENT_HUGEPAGE */ 43static inline void khugepaged_fork(struct mm_struct *mm, struct mm_struct *oldmm) 44{ 45} 46static inline void khugepaged_exit(struct mm_struct *mm) 47{ 48} 49static inline void khugepaged_enter_vma(struct vm_area_struct *vma, 50 unsigned long vm_flags) 51{ 52} 53static inline int collapse_pte_mapped_thp(struct mm_struct *mm, 54 unsigned long addr, bool install_pmd) 55{ 56 return 0; 57} 58 59static inline void khugepaged_min_free_kbytes_update(void) 60{ 61} 62 63static inline bool current_is_khugepaged(void) 64{ 65 return false; 66} 67#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ 68 69#endif /* _LINUX_KHUGEPAGED_H */