--- include/linux/page-flags.h | 46 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) Index: linux-2.6/include/linux/page-flags.h =================================================================== --- linux-2.6.orig/include/linux/page-flags.h 2008-02-17 21:11:40.000000000 -0800 +++ linux-2.6/include/linux/page-flags.h 2008-02-17 21:12:14.000000000 -0800 @@ -87,6 +87,20 @@ enum pageflags { PG_reclaim, /* To be reclaimed asap */ PG_buddy, /* Page is free, on buddy lists */ +#ifdef CONFIG_EXTENDED_PAGE_FLAGS +/* + * Page flags that are only available without sparsemem + * (sparsemem vmemmap is ok) + */ + + PG_mlock, /* Page cannot be swapped out */ + PG_pin, /* Page cannot be moved in memory */ + PG_tail, /* Tail of a compound page */ + PG_export, /* Page is referenced directly from a driver */ + PG_vcompound, /* Compound page is virtually mapped */ + PG_filebacked, /* Page is backed by an actual disk (not RAM) */ +#endif + #ifdef CONFIG_IA64_UNCACHED_ALLOCATOR PG_uncached, /* Page has been mapped as uncached */ #endif @@ -99,8 +113,14 @@ enum pageflags { #define FLAGS_IA64 0 #endif +#ifdef CONFIG_EXTENDED_BASE_FLAGS +#define FLAGS_EXTENDED 6 +#else +#define FLAGS_EXTENDED 0 +#endif + #define FLAGS_NORMAL 18 -#define NR_PAGEFLAGS (FLAGS_NORMAL + FLAGS_IA64) +#define NR_PAGEFLAGS (FLAGS_NORMAL + FLAGS_EXTENDED + FLAGS_IA64) struct page; /* forward declaration */ @@ -253,6 +273,28 @@ static inline void set_page_writeback(st __PAGEFLAG(Compound, head) __PAGEFLAG(Head, head) +#ifdef CONFIG_EXTENDED_PAGE_FLAGS + +__PAGEFLAG(Head, head) +__PAGEFLAG(Tail, tail) +__PAGEFLAG(Vcompound, vcompound) +__PAGEFLAG(Mlock, mlock) +__PAGEFLAG(Pin, pin) +__PAGEFLAG(FileBacked, filebacked) +__PAGEFLAG(Export, export) + +static inline int PageCompound(struct page *page) +{ + return (page->flags & ((1 << PG_tail) | (1 << PG_head))) != 0; +} + +#else +/* + * Fallback for sparsemem (not vmemmap) configurations that require + * the use of a lot of page flags. Could be removed if those + * sparsemem configuration are no longer used. + */ + /* * PG_reclaim is used in combination with PG_compound to mark the * head and tail of a compound page. This saved one page flag @@ -285,4 +327,6 @@ static inline void __ClearPageTail(struc */ __PAGEFLAG(Vcompound, dirty) +#endif + #endif /* PAGE_FLAGS_H */