1 #ifndef _LINUX_SWAPOPS_H
2 #define _LINUX_SWAPOPS_H
19 #define SWP_TYPE_SHIFT(e) ((sizeof(e.val) * 8) - \
20 (MAX_SWAPFILES_SHIFT + RADIX_TREE_EXCEPTIONAL_SHIFT))
21 #define SWP_OFFSET_MASK(e) ((1UL << SWP_TYPE_SHIFT(e)) - 1)
55 static inline int is_swap_pte(
pte_t pte)
82 arch_entry =
__swp_entry(swp_type(entry), swp_offset(entry));
95 static inline void *swp_to_radix_entry(
swp_entry_t entry)
103 #ifdef CONFIG_MIGRATION
106 BUG_ON(!PageLocked(page));
107 return swp_entry(write ? SWP_MIGRATION_WRITE : SWP_MIGRATION_READ,
111 static inline int is_migration_entry(
swp_entry_t entry)
113 return unlikely(swp_type(entry) == SWP_MIGRATION_READ ||
114 swp_type(entry) == SWP_MIGRATION_WRITE);
117 static inline int is_write_migration_entry(
swp_entry_t entry)
119 return unlikely(swp_type(entry) == SWP_MIGRATION_WRITE);
133 static inline void make_migration_entry_read(
swp_entry_t *entry)
135 *entry = swp_entry(SWP_MIGRATION_READ, swp_offset(*entry));
142 #define make_migration_entry(page, write) swp_entry(0, 0)
143 static inline int is_migration_entry(
swp_entry_t swp)
147 #define migration_entry_to_page(swp) NULL
148 static inline void make_migration_entry_read(
swp_entry_t *entryp) { }
151 static inline int is_write_migration_entry(
swp_entry_t entry)
158 #ifdef CONFIG_MEMORY_FAILURE
162 static inline swp_entry_t make_hwpoison_entry(
struct page *page)
164 BUG_ON(!PageLocked(page));
168 static inline int is_hwpoison_entry(
swp_entry_t entry)
170 return swp_type(entry) == SWP_HWPOISON;
174 static inline swp_entry_t make_hwpoison_entry(
struct page *page)
176 return swp_entry(0, 0);
179 static inline int is_hwpoison_entry(
swp_entry_t swp)
185 #if defined(CONFIG_MEMORY_FAILURE) || defined(CONFIG_MIGRATION)
186 static inline int non_swap_entry(
swp_entry_t entry)
191 static inline int non_swap_entry(
swp_entry_t entry)