1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 #ifndef _LINUX_SECRETMEM_H
3 #define _LINUX_SECRETMEM_H
5 #ifdef CONFIG_SECRETMEM
7 extern const struct address_space_operations secretmem_aops
;
9 static inline bool page_is_secretmem(struct page
*page
)
11 struct address_space
*mapping
;
14 * Using page_mapping() is quite slow because of the actual call
15 * instruction and repeated compound_head(page) inside the
16 * page_mapping() function.
17 * We know that secretmem pages are not compound and LRU so we can
18 * save a couple of cycles here.
20 if (PageCompound(page
) || !PageLRU(page
))
23 mapping
= (struct address_space
*)
24 ((unsigned long)page
->mapping
& ~PAGE_MAPPING_FLAGS
);
26 if (mapping
!= page
->mapping
)
29 return mapping
->a_ops
== &secretmem_aops
;
32 bool vma_is_secretmem(struct vm_area_struct
*vma
);
33 bool secretmem_active(void);
37 static inline bool vma_is_secretmem(struct vm_area_struct
*vma
)
42 static inline bool page_is_secretmem(struct page
*page
)
47 static inline bool secretmem_active(void)
52 #endif /* CONFIG_SECRETMEM */
54 #endif /* _LINUX_SECRETMEM_H */