@@ -87,7 +87,6 @@ enum pageflags {
87
87
PG_private_2 , /* If pagecache, has fs aux data */
88
88
PG_writeback , /* Page is under writeback */
89
89
PG_head , /* A head page */
90
- PG_swapcache , /* Swap page: swp_entry_t in private */
91
90
PG_mappedtodisk , /* Has blocks allocated on-disk */
92
91
PG_reclaim , /* To be reclaimed asap */
93
92
PG_swapbacked , /* Page is backed by RAM/swap */
@@ -110,6 +109,9 @@ enum pageflags {
110
109
/* Filesystems */
111
110
PG_checked = PG_owner_priv_1 ,
112
111
112
+ /* SwapBacked */
113
+ PG_swapcache = PG_owner_priv_1 , /* Swap page: swp_entry_t in private */
114
+
113
115
/* Two page bits are conscripted by FS-Cache to maintain local caching
114
116
* state. These bits are set on pages belonging to the netfs's inodes
115
117
* when those inodes are being locally cached.
@@ -314,7 +316,13 @@ PAGEFLAG_FALSE(HighMem)
314
316
#endif
315
317
316
318
#ifdef CONFIG_SWAP
317
- PAGEFLAG (SwapCache , swapcache , PF_NO_COMPOUND )
319
+ static __always_inline int PageSwapCache (struct page * page )
320
+ {
321
+ return PageSwapBacked (page ) && test_bit (PG_swapcache , & page -> flags );
322
+
323
+ }
324
+ SETPAGEFLAG (SwapCache , swapcache , PF_NO_COMPOUND )
325
+ CLEARPAGEFLAG (SwapCache , swapcache , PF_NO_COMPOUND )
318
326
#else
319
327
PAGEFLAG_FALSE (SwapCache )
320
328
#endif
@@ -701,12 +709,12 @@ static inline void ClearPageSlabPfmemalloc(struct page *page)
701
709
* Flags checked when a page is freed. Pages being freed should not have
702
710
* these flags set. It they are, there is a problem.
703
711
*/
704
- #define PAGE_FLAGS_CHECK_AT_FREE \
705
- (1UL << PG_lru | 1UL << PG_locked | \
706
- 1UL << PG_private | 1UL << PG_private_2 | \
707
- 1UL << PG_writeback | 1UL << PG_reserved | \
708
- 1UL << PG_slab | 1UL << PG_swapcache | 1UL << PG_active | \
709
- 1UL << PG_unevictable | __PG_MLOCKED)
712
+ #define PAGE_FLAGS_CHECK_AT_FREE \
713
+ (1UL << PG_lru | 1UL << PG_locked | \
714
+ 1UL << PG_private | 1UL << PG_private_2 | \
715
+ 1UL << PG_writeback | 1UL << PG_reserved | \
716
+ 1UL << PG_slab | 1UL << PG_active | \
717
+ 1UL << PG_unevictable | __PG_MLOCKED)
710
718
711
719
/*
712
720
* Flags checked when a page is prepped for return by the page allocator.
0 commit comments