@@ -248,6 +248,14 @@ static inline struct page *encoded_page_ptr(struct encoded_page *page)
248
248
return (struct page * )(~ENCODE_PAGE_BITS & (unsigned long )page );
249
249
}
250
250
251
+ /*
252
+ * A swap entry has to fit into a "unsigned long", as the entry is hidden
253
+ * in the "index" field of the swapper address space.
254
+ */
255
+ typedef struct {
256
+ unsigned long val ;
257
+ } swp_entry_t ;
258
+
251
259
/**
252
260
* struct folio - Represents a contiguous set of bytes.
253
261
* @flags: Identical to the page flags.
@@ -258,7 +266,7 @@ static inline struct page *encoded_page_ptr(struct encoded_page *page)
258
266
* @index: Offset within the file, in units of pages. For anonymous memory,
259
267
* this is the index from the beginning of the mmap.
260
268
* @private: Filesystem per-folio data (see folio_attach_private()).
261
- * Used for swp_entry_t if folio_test_swapcache().
269
+ * @swap: Used for swp_entry_t if folio_test_swapcache().
262
270
* @_mapcount: Do not access this member directly. Use folio_mapcount() to
263
271
* find out how many times this folio is mapped by userspace.
264
272
* @_refcount: Do not access this member directly. Use folio_ref_count()
@@ -301,7 +309,10 @@ struct folio {
301
309
};
302
310
struct address_space * mapping ;
303
311
pgoff_t index ;
304
- void * private ;
312
+ union {
313
+ void * private ;
314
+ swp_entry_t swap ;
315
+ };
305
316
atomic_t _mapcount ;
306
317
atomic_t _refcount ;
307
318
#ifdef CONFIG_MEMCG
@@ -1209,14 +1220,6 @@ enum tlb_flush_reason {
1209
1220
NR_TLB_FLUSH_REASONS ,
1210
1221
};
1211
1222
1212
- /*
1213
- * A swap entry has to fit into a "unsigned long", as the entry is hidden
1214
- * in the "index" field of the swapper address space.
1215
- */
1216
- typedef struct {
1217
- unsigned long val ;
1218
- } swp_entry_t ;
1219
-
1220
1223
/**
1221
1224
* enum fault_flag - Fault flag definitions.
1222
1225
* @FAULT_FLAG_WRITE: Fault was a write fault.
0 commit comments