xref: /linux/include/linux/hugetlb_inline.h (revision eeccf287a2a517954b57cf9d733b3cf5d47afa34)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_HUGETLB_INLINE_H
3 #define _LINUX_HUGETLB_INLINE_H
4 
5 #include <linux/mm.h>
6 
7 #ifdef CONFIG_HUGETLB_PAGE
8 
is_vm_hugetlb_flags(vm_flags_t vm_flags)9 static inline bool is_vm_hugetlb_flags(vm_flags_t vm_flags)
10 {
11 	return !!(vm_flags & VM_HUGETLB);
12 }
13 
is_vma_hugetlb_flags(const vma_flags_t * flags)14 static inline bool is_vma_hugetlb_flags(const vma_flags_t *flags)
15 {
16 	return vma_flags_test(flags, VMA_HUGETLB_BIT);
17 }
18 
19 #else
20 
is_vm_hugetlb_flags(vm_flags_t vm_flags)21 static inline bool is_vm_hugetlb_flags(vm_flags_t vm_flags)
22 {
23 	return false;
24 }
25 
is_vma_hugetlb_flags(const vma_flags_t * flags)26 static inline bool is_vma_hugetlb_flags(const vma_flags_t *flags)
27 {
28 	return false;
29 }
30 
31 #endif
32 
is_vm_hugetlb_page(struct vm_area_struct * vma)33 static inline bool is_vm_hugetlb_page(struct vm_area_struct *vma)
34 {
35 	return is_vm_hugetlb_flags(vma->vm_flags);
36 }
37 
38 #endif
39