aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/page-flags.h28
-rw-r--r--mm/Kconfig12
2 files changed, 40 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
266static 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 */
251TESTPAGEFLAG(Compound, compound) 278TESTPAGEFLAG(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 */
diff --git a/mm/Kconfig b/mm/Kconfig
index 0016ebd4dcba..3aa819d628c1 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -143,6 +143,18 @@ config MEMORY_HOTREMOVE
143 depends on MEMORY_HOTPLUG && ARCH_ENABLE_MEMORY_HOTREMOVE 143 depends on MEMORY_HOTPLUG && ARCH_ENABLE_MEMORY_HOTREMOVE
144 depends on MIGRATION 144 depends on MIGRATION
145 145
146#
147# If we have space for more page flags then we can enable additional
148# optimizations and functionality.
149#
150# Regular Sparsemem takes page flag bits for the sectionid if it does not
151# use a virtual memmap. Disable extended page flags for 32 bit platforms
152# that require the use of a sectionid in the page flags.
153#
154config PAGEFLAGS_EXTENDED
155 def_bool y
156 depends on 64BIT || SPARSEMEM_VMEMMAP || !NUMA || !SPARSEMEM
157
146# Heavily threaded applications may benefit from splitting the mm-wide 158# Heavily threaded applications may benefit from splitting the mm-wide
147# page_table_lock, so that faults on different parts of the user address 159# page_table_lock, so that faults on different parts of the user address
148# space can be handled with less contention: split it at this NR_CPUS. 160# space can be handled with less contention: split it at this NR_CPUS.