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 folio_is_secretmem(struct folio *folio)
11 struct address_space *mapping;
14 * Using folio_mapping() is quite slow because of the actual call
16 * We know that secretmem pages are not compound and LRU so we can
17 * save a couple of cycles here.
19 if (folio_test_large(folio) || !folio_test_lru(folio))
22 mapping = (struct address_space *)
23 ((unsigned long)folio->mapping & ~PAGE_MAPPING_FLAGS);
25 if (!mapping || mapping != folio->mapping)
28 return mapping->a_ops == &secretmem_aops;
31 bool vma_is_secretmem(struct vm_area_struct *vma);
32 bool secretmem_active(void);
36 static inline bool vma_is_secretmem(struct vm_area_struct *vma)
41 static inline bool folio_is_secretmem(struct folio *folio)
46 static inline bool secretmem_active(void)
51 #endif /* CONFIG_SECRETMEM */
53 #endif /* _LINUX_SECRETMEM_H */