diff options
Diffstat (limited to 'include/linux/page-flags.h')
-rw-r--r-- | include/linux/page-flags.h | 60 |
1 files changed, 47 insertions, 13 deletions
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 219a523ecdb0..62214c7d2d93 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h | |||
@@ -82,6 +82,7 @@ enum pageflags { | |||
82 | PG_arch_1, | 82 | PG_arch_1, |
83 | PG_reserved, | 83 | PG_reserved, |
84 | PG_private, /* If pagecache, has fs-private data */ | 84 | PG_private, /* If pagecache, has fs-private data */ |
85 | PG_private_2, /* If pagecache, has fs aux data */ | ||
85 | PG_writeback, /* Page is under writeback */ | 86 | PG_writeback, /* Page is under writeback */ |
86 | #ifdef CONFIG_PAGEFLAGS_EXTENDED | 87 | #ifdef CONFIG_PAGEFLAGS_EXTENDED |
87 | PG_head, /* A head page */ | 88 | PG_head, /* A head page */ |
@@ -96,6 +97,8 @@ enum pageflags { | |||
96 | PG_swapbacked, /* Page is backed by RAM/swap */ | 97 | PG_swapbacked, /* Page is backed by RAM/swap */ |
97 | #ifdef CONFIG_UNEVICTABLE_LRU | 98 | #ifdef CONFIG_UNEVICTABLE_LRU |
98 | PG_unevictable, /* Page is "unevictable" */ | 99 | PG_unevictable, /* Page is "unevictable" */ |
100 | #endif | ||
101 | #ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT | ||
99 | PG_mlocked, /* Page is vma mlocked */ | 102 | PG_mlocked, /* Page is vma mlocked */ |
100 | #endif | 103 | #endif |
101 | #ifdef CONFIG_IA64_UNCACHED_ALLOCATOR | 104 | #ifdef CONFIG_IA64_UNCACHED_ALLOCATOR |
@@ -106,6 +109,12 @@ enum pageflags { | |||
106 | /* Filesystems */ | 109 | /* Filesystems */ |
107 | PG_checked = PG_owner_priv_1, | 110 | PG_checked = PG_owner_priv_1, |
108 | 111 | ||
112 | /* Two page bits are conscripted by FS-Cache to maintain local caching | ||
113 | * state. These bits are set on pages belonging to the netfs's inodes | ||
114 | * when those inodes are being locally cached. | ||
115 | */ | ||
116 | PG_fscache = PG_private_2, /* page backed by cache */ | ||
117 | |||
109 | /* XEN */ | 118 | /* XEN */ |
110 | PG_pinned = PG_owner_priv_1, | 119 | PG_pinned = PG_owner_priv_1, |
111 | PG_savepinned = PG_dirty, | 120 | PG_savepinned = PG_dirty, |
@@ -180,7 +189,7 @@ static inline int TestClearPage##uname(struct page *page) { return 0; } | |||
180 | 189 | ||
181 | struct page; /* forward declaration */ | 190 | struct page; /* forward declaration */ |
182 | 191 | ||
183 | TESTPAGEFLAG(Locked, locked) | 192 | TESTPAGEFLAG(Locked, locked) TESTSETFLAG(Locked, locked) |
184 | PAGEFLAG(Error, error) | 193 | PAGEFLAG(Error, error) |
185 | PAGEFLAG(Referenced, referenced) TESTCLEARFLAG(Referenced, referenced) | 194 | PAGEFLAG(Referenced, referenced) TESTCLEARFLAG(Referenced, referenced) |
186 | PAGEFLAG(Dirty, dirty) TESTSCFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty) | 195 | PAGEFLAG(Dirty, dirty) TESTSCFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty) |
@@ -192,8 +201,6 @@ PAGEFLAG(Checked, checked) /* Used by some filesystems */ | |||
192 | PAGEFLAG(Pinned, pinned) TESTSCFLAG(Pinned, pinned) /* Xen */ | 201 | PAGEFLAG(Pinned, pinned) TESTSCFLAG(Pinned, pinned) /* Xen */ |
193 | PAGEFLAG(SavePinned, savepinned); /* Xen */ | 202 | PAGEFLAG(SavePinned, savepinned); /* Xen */ |
194 | PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved) | 203 | PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved) |
195 | PAGEFLAG(Private, private) __CLEARPAGEFLAG(Private, private) | ||
196 | __SETPAGEFLAG(Private, private) | ||
197 | PAGEFLAG(SwapBacked, swapbacked) __CLEARPAGEFLAG(SwapBacked, swapbacked) | 204 | PAGEFLAG(SwapBacked, swapbacked) __CLEARPAGEFLAG(SwapBacked, swapbacked) |
198 | 205 | ||
199 | __PAGEFLAG(SlobPage, slob_page) | 206 | __PAGEFLAG(SlobPage, slob_page) |
@@ -203,6 +210,16 @@ __PAGEFLAG(SlubFrozen, slub_frozen) | |||
203 | __PAGEFLAG(SlubDebug, slub_debug) | 210 | __PAGEFLAG(SlubDebug, slub_debug) |
204 | 211 | ||
205 | /* | 212 | /* |
213 | * Private page markings that may be used by the filesystem that owns the page | ||
214 | * for its own purposes. | ||
215 | * - PG_private and PG_private_2 cause releasepage() and co to be invoked | ||
216 | */ | ||
217 | PAGEFLAG(Private, private) __SETPAGEFLAG(Private, private) | ||
218 | __CLEARPAGEFLAG(Private, private) | ||
219 | PAGEFLAG(Private2, private_2) TESTSCFLAG(Private2, private_2) | ||
220 | PAGEFLAG(OwnerPriv1, owner_priv_1) TESTCLEARFLAG(OwnerPriv1, owner_priv_1) | ||
221 | |||
222 | /* | ||
206 | * Only test-and-set exist for PG_writeback. The unconditional operators are | 223 | * Only test-and-set exist for PG_writeback. The unconditional operators are |
207 | * risky: they bypass page accounting. | 224 | * risky: they bypass page accounting. |
208 | */ | 225 | */ |
@@ -234,20 +251,20 @@ PAGEFLAG_FALSE(SwapCache) | |||
234 | #ifdef CONFIG_UNEVICTABLE_LRU | 251 | #ifdef CONFIG_UNEVICTABLE_LRU |
235 | PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable) | 252 | PAGEFLAG(Unevictable, unevictable) __CLEARPAGEFLAG(Unevictable, unevictable) |
236 | TESTCLEARFLAG(Unevictable, unevictable) | 253 | TESTCLEARFLAG(Unevictable, unevictable) |
254 | #else | ||
255 | PAGEFLAG_FALSE(Unevictable) TESTCLEARFLAG_FALSE(Unevictable) | ||
256 | SETPAGEFLAG_NOOP(Unevictable) CLEARPAGEFLAG_NOOP(Unevictable) | ||
257 | __CLEARPAGEFLAG_NOOP(Unevictable) | ||
258 | #endif | ||
237 | 259 | ||
260 | #ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT | ||
238 | #define MLOCK_PAGES 1 | 261 | #define MLOCK_PAGES 1 |
239 | PAGEFLAG(Mlocked, mlocked) __CLEARPAGEFLAG(Mlocked, mlocked) | 262 | PAGEFLAG(Mlocked, mlocked) __CLEARPAGEFLAG(Mlocked, mlocked) |
240 | TESTSCFLAG(Mlocked, mlocked) | 263 | TESTSCFLAG(Mlocked, mlocked) |
241 | |||
242 | #else | 264 | #else |
243 | |||
244 | #define MLOCK_PAGES 0 | 265 | #define MLOCK_PAGES 0 |
245 | PAGEFLAG_FALSE(Mlocked) | 266 | PAGEFLAG_FALSE(Mlocked) |
246 | SETPAGEFLAG_NOOP(Mlocked) TESTCLEARFLAG_FALSE(Mlocked) | 267 | SETPAGEFLAG_NOOP(Mlocked) TESTCLEARFLAG_FALSE(Mlocked) |
247 | |||
248 | PAGEFLAG_FALSE(Unevictable) TESTCLEARFLAG_FALSE(Unevictable) | ||
249 | SETPAGEFLAG_NOOP(Unevictable) CLEARPAGEFLAG_NOOP(Unevictable) | ||
250 | __CLEARPAGEFLAG_NOOP(Unevictable) | ||
251 | #endif | 268 | #endif |
252 | 269 | ||
253 | #ifdef CONFIG_IA64_UNCACHED_ALLOCATOR | 270 | #ifdef CONFIG_IA64_UNCACHED_ALLOCATOR |
@@ -367,9 +384,13 @@ static inline void __ClearPageTail(struct page *page) | |||
367 | 384 | ||
368 | #ifdef CONFIG_UNEVICTABLE_LRU | 385 | #ifdef CONFIG_UNEVICTABLE_LRU |
369 | #define __PG_UNEVICTABLE (1 << PG_unevictable) | 386 | #define __PG_UNEVICTABLE (1 << PG_unevictable) |
370 | #define __PG_MLOCKED (1 << PG_mlocked) | ||
371 | #else | 387 | #else |
372 | #define __PG_UNEVICTABLE 0 | 388 | #define __PG_UNEVICTABLE 0 |
389 | #endif | ||
390 | |||
391 | #ifdef CONFIG_HAVE_MLOCKED_PAGE_BIT | ||
392 | #define __PG_MLOCKED (1 << PG_mlocked) | ||
393 | #else | ||
373 | #define __PG_MLOCKED 0 | 394 | #define __PG_MLOCKED 0 |
374 | #endif | 395 | #endif |
375 | 396 | ||
@@ -378,9 +399,10 @@ static inline void __ClearPageTail(struct page *page) | |||
378 | * these flags set. It they are, there is a problem. | 399 | * these flags set. It they are, there is a problem. |
379 | */ | 400 | */ |
380 | #define PAGE_FLAGS_CHECK_AT_FREE \ | 401 | #define PAGE_FLAGS_CHECK_AT_FREE \ |
381 | (1 << PG_lru | 1 << PG_private | 1 << PG_locked | \ | 402 | (1 << PG_lru | 1 << PG_locked | \ |
382 | 1 << PG_buddy | 1 << PG_writeback | 1 << PG_reserved | \ | 403 | 1 << PG_private | 1 << PG_private_2 | \ |
383 | 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \ | 404 | 1 << PG_buddy | 1 << PG_writeback | 1 << PG_reserved | \ |
405 | 1 << PG_slab | 1 << PG_swapcache | 1 << PG_active | \ | ||
384 | __PG_UNEVICTABLE | __PG_MLOCKED) | 406 | __PG_UNEVICTABLE | __PG_MLOCKED) |
385 | 407 | ||
386 | /* | 408 | /* |
@@ -391,4 +413,16 @@ static inline void __ClearPageTail(struct page *page) | |||
391 | #define PAGE_FLAGS_CHECK_AT_PREP ((1 << NR_PAGEFLAGS) - 1) | 413 | #define PAGE_FLAGS_CHECK_AT_PREP ((1 << NR_PAGEFLAGS) - 1) |
392 | 414 | ||
393 | #endif /* !__GENERATING_BOUNDS_H */ | 415 | #endif /* !__GENERATING_BOUNDS_H */ |
416 | |||
417 | /** | ||
418 | * page_has_private - Determine if page has private stuff | ||
419 | * @page: The page to be checked | ||
420 | * | ||
421 | * Determine if a page has private stuff, indicating that release routines | ||
422 | * should be invoked upon it. | ||
423 | */ | ||
424 | #define page_has_private(page) \ | ||
425 | ((page)->flags & ((1 << PG_private) | \ | ||
426 | (1 << PG_private_2))) | ||
427 | |||
394 | #endif /* PAGE_FLAGS_H */ | 428 | #endif /* PAGE_FLAGS_H */ |