diff options
Diffstat (limited to 'include/linux/page-flags.h')
-rw-r--r-- | include/linux/page-flags.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index d16efa9066d9..590cff32415d 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h | |||
@@ -83,7 +83,12 @@ enum pageflags { | |||
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_writeback, /* Page is under writeback */ | 85 | PG_writeback, /* Page is under writeback */ |
86 | #ifdef CONFIG_PAGEFLAGS_EXTENDED | ||
87 | PG_head, /* A head page */ | ||
88 | PG_tail, /* A tail page */ | ||
89 | #else | ||
86 | PG_compound, /* A compound page */ | 90 | PG_compound, /* A compound page */ |
91 | #endif | ||
87 | PG_swapcache, /* Swap page: swp_entry_t in private */ | 92 | PG_swapcache, /* Swap page: swp_entry_t in private */ |
88 | PG_mappedtodisk, /* Has blocks allocated on-disk */ | 93 | PG_mappedtodisk, /* Has blocks allocated on-disk */ |
89 | PG_reclaim, /* To be reclaimed asap */ | 94 | PG_reclaim, /* To be reclaimed asap */ |
@@ -248,6 +253,28 @@ static inline void set_page_writeback(struct page *page) | |||
248 | test_set_page_writeback(page); | 253 | test_set_page_writeback(page); |
249 | } | 254 | } |
250 | 255 | ||
256 | #ifdef CONFIG_PAGEFLAGS_EXTENDED | ||
257 | /* | ||
258 | * System with lots of page flags available. This allows separate | ||
259 | * flags for PageHead() and PageTail() checks of compound pages so that bit | ||
260 | * tests can be used in performance sensitive paths. PageCompound is | ||
261 | * generally not used in hot code paths. | ||
262 | */ | ||
263 | __PAGEFLAG(Head, head) | ||
264 | __PAGEFLAG(Tail, tail) | ||
265 | |||
266 | static inline int PageCompound(struct page *page) | ||
267 | { | ||
268 | return page->flags & ((1L << PG_head) | (1L << PG_tail)); | ||
269 | |||
270 | } | ||
271 | #else | ||
272 | /* | ||
273 | * Reduce page flag use as much as possible by overlapping | ||
274 | * compound page flags with the flags used for page cache pages. Possible | ||
275 | * because PageCompound is always set for compound pages and not for | ||
276 | * pages on the LRU and/or pagecache. | ||
277 | */ | ||
251 | TESTPAGEFLAG(Compound, compound) | 278 | TESTPAGEFLAG(Compound, compound) |
252 | __PAGEFLAG(Head, compound) | 279 | __PAGEFLAG(Head, compound) |
253 | 280 | ||
@@ -278,5 +305,6 @@ static inline void __ClearPageTail(struct page *page) | |||
278 | page->flags &= ~PG_head_tail_mask; | 305 | page->flags &= ~PG_head_tail_mask; |
279 | } | 306 | } |
280 | 307 | ||
308 | #endif /* !PAGEFLAGS_EXTENDED */ | ||
281 | #endif /* !__GENERATING_BOUNDS_H */ | 309 | #endif /* !__GENERATING_BOUNDS_H */ |
282 | #endif /* PAGE_FLAGS_H */ | 310 | #endif /* PAGE_FLAGS_H */ |