---
 include/linux/page-flags.h |   27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

Index: linux-2.6.25-rc5-mm1/include/linux/page-flags.h
===================================================================
--- linux-2.6.25-rc5-mm1.orig/include/linux/page-flags.h	2008-03-26 20:59:33.877919060 -0700
+++ linux-2.6.25-rc5-mm1/include/linux/page-flags.h	2008-03-27 18:34:58.217919121 -0700
@@ -89,7 +89,12 @@ enum pageflags {
 	PG_reserved,
 	PG_private,		/* If pagecache, has fs-private data */
 	PG_writeback,		/* Page is under writeback */
+#ifdef CONFIG_64BIT
+	PG_head,		/* A head page */
+	PG_tail,		/* A tail page */
+#else
 	PG_compound,		/* A compound page */
+#endif
 	PG_swapcache,		/* Swap page: swp_entry_t in private */
 	PG_mappedtodisk,	/* Has blocks allocated on-disk */
 	PG_reclaim,		/* To be reclaimed asap */
@@ -259,6 +264,27 @@ static inline void set_page_writeback(st
 	test_set_page_writeback(page);
 }
 
+#ifdef CONFIG_64BIT
+/*
+ * 64Bit system with lots of page flags available. This allows separate
+ * flags for compound pages so that bit tests can be used in performance
+ * sensitive paths.
+ */
+__PAGEFLAG(Head, head)
+__PAGEFLAG(Tail, tail)
+
+static inline int PageCompound(struct page *page)
+{
+	return page->flags & ((1L << PG_head) | (1L << PG_tail));
+
+}
+#else
+/*
+ * 32bit system. Reduce page flag use as much as possible by overlapping
+ * compound page flags with the flags used for page cache pages. Possible
+ * because PageCompound is always set for compound pages and not for
+ * pages on the LRU and/or pagecache.
+ */
 TESTPAGEFLAG(Compound, compound)
 __PAGEFLAG(Head, compound)
 
@@ -289,5 +315,6 @@ static inline void __ClearPageTail(struc
 	page->flags &= ~PG_head_tail_mask;
 }
 
+#endif /* !64BIT */
 #endif /* !__GENERATING_BOUNDS_H */
 #endif	/* PAGE_FLAGS_H */