aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2016-12-24 22:00:29 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2016-12-25 14:54:48 -0500
commit6326fec1122cde256bd2a8c63f2606e08e44ce1d (patch)
tree5e5bc0e4c71903bbdc6477f4868d35f970743e21 /include
parent7c0f6ba682b9c7632072ffbedf8d328c8f3c42ba (diff)
mm: Use owner_priv bit for PageSwapCache, valid when PageSwapBacked
A page is not added to the swap cache without being swap backed, so PageSwapBacked mappings can use PG_owner_priv_1 for PageSwapCache. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Acked-by: Hugh Dickins <hughd@google.com> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: Bob Peterson <rpeterso@redhat.com> Cc: Steven Whitehouse <swhiteho@redhat.com> Cc: Andrew Lutomirski <luto@kernel.org> Cc: Andreas Gruenbacher <agruenba@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Mel Gorman <mgorman@techsingularity.net> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/page-flags.h24
-rw-r--r--include/trace/events/mmflags.h1
2 files changed, 16 insertions, 9 deletions
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 74e4dda91238..a57c909a15e4 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -87,7 +87,6 @@ enum pageflags {
87 PG_private_2, /* If pagecache, has fs aux data */ 87 PG_private_2, /* If pagecache, has fs aux data */
88 PG_writeback, /* Page is under writeback */ 88 PG_writeback, /* Page is under writeback */
89 PG_head, /* A head page */ 89 PG_head, /* A head page */
90 PG_swapcache, /* Swap page: swp_entry_t in private */
91 PG_mappedtodisk, /* Has blocks allocated on-disk */ 90 PG_mappedtodisk, /* Has blocks allocated on-disk */
92 PG_reclaim, /* To be reclaimed asap */ 91 PG_reclaim, /* To be reclaimed asap */
93 PG_swapbacked, /* Page is backed by RAM/swap */ 92 PG_swapbacked, /* Page is backed by RAM/swap */
@@ -110,6 +109,9 @@ enum pageflags {
110 /* Filesystems */ 109 /* Filesystems */
111 PG_checked = PG_owner_priv_1, 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 /* Two page bits are conscripted by FS-Cache to maintain local caching 115 /* Two page bits are conscripted by FS-Cache to maintain local caching
114 * state. These bits are set on pages belonging to the netfs's inodes 116 * state. These bits are set on pages belonging to the netfs's inodes
115 * when those inodes are being locally cached. 117 * when those inodes are being locally cached.
@@ -314,7 +316,13 @@ PAGEFLAG_FALSE(HighMem)
314#endif 316#endif
315 317
316#ifdef CONFIG_SWAP 318#ifdef CONFIG_SWAP
317PAGEFLAG(SwapCache, swapcache, PF_NO_COMPOUND) 319static __always_inline int PageSwapCache(struct page *page)
320{
321 return PageSwapBacked(page) && test_bit(PG_swapcache, &page->flags);
322
323}
324SETPAGEFLAG(SwapCache, swapcache, PF_NO_COMPOUND)
325CLEARPAGEFLAG(SwapCache, swapcache, PF_NO_COMPOUND)
318#else 326#else
319PAGEFLAG_FALSE(SwapCache) 327PAGEFLAG_FALSE(SwapCache)
320#endif 328#endif
@@ -701,12 +709,12 @@ static inline void ClearPageSlabPfmemalloc(struct page *page)
701 * Flags checked when a page is freed. Pages being freed should not have 709 * Flags checked when a page is freed. Pages being freed should not have
702 * these flags set. It they are, there is a problem. 710 * these flags set. It they are, there is a problem.
703 */ 711 */
704#define PAGE_FLAGS_CHECK_AT_FREE \ 712#define PAGE_FLAGS_CHECK_AT_FREE \
705 (1UL << PG_lru | 1UL << PG_locked | \ 713 (1UL << PG_lru | 1UL << PG_locked | \
706 1UL << PG_private | 1UL << PG_private_2 | \ 714 1UL << PG_private | 1UL << PG_private_2 | \
707 1UL << PG_writeback | 1UL << PG_reserved | \ 715 1UL << PG_writeback | 1UL << PG_reserved | \
708 1UL << PG_slab | 1UL << PG_swapcache | 1UL << PG_active | \ 716 1UL << PG_slab | 1UL << PG_active | \
709 1UL << PG_unevictable | __PG_MLOCKED) 717 1UL << PG_unevictable | __PG_MLOCKED)
710 718
711/* 719/*
712 * Flags checked when a page is prepped for return by the page allocator. 720 * Flags checked when a page is prepped for return by the page allocator.
diff --git a/include/trace/events/mmflags.h b/include/trace/events/mmflags.h
index 5a81ab48a2fb..30c2adbdebe8 100644
--- a/include/trace/events/mmflags.h
+++ b/include/trace/events/mmflags.h
@@ -95,7 +95,6 @@
95 {1UL << PG_private_2, "private_2" }, \ 95 {1UL << PG_private_2, "private_2" }, \
96 {1UL << PG_writeback, "writeback" }, \ 96 {1UL << PG_writeback, "writeback" }, \
97 {1UL << PG_head, "head" }, \ 97 {1UL << PG_head, "head" }, \
98 {1UL << PG_swapcache, "swapcache" }, \
99 {1UL << PG_mappedtodisk, "mappedtodisk" }, \ 98 {1UL << PG_mappedtodisk, "mappedtodisk" }, \
100 {1UL << PG_reclaim, "reclaim" }, \ 99 {1UL << PG_reclaim, "reclaim" }, \
101 {1UL << PG_swapbacked, "swapbacked" }, \ 100 {1UL << PG_swapbacked, "swapbacked" }, \