From d5c3be496cb72dc1667115094b6e52242b6c80fe Mon Sep 17 00:00:00 2001 From: Christoph Lameter Date: Wed, 3 Oct 2007 20:42:43 -0700 Subject: vcompound: pageflags: Add PageVcompound() Add a another page flag that can be used to figure out if a compound page is virtually mapped. The mark is necessary since we have to know when freeing pages if we have to destroy a virtual mapping. No additional flag is needed. We use PG_swapcache together with PG_compound (similar to PageHead() and PageTail()) to signal that a compound page is virtually mapped. PG_swapcache is not used at this point since compound pages cannot be put onto the LRU (yet). Signed-off-by: Christoph Lameter --- include/linux/page-flags.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) Index: linux-2.6.25-rc8-mm2/include/linux/page-flags.h =================================================================== --- linux-2.6.25-rc8-mm2.orig/include/linux/page-flags.h 2008-04-24 00:35:46.942399372 -0700 +++ linux-2.6.25-rc8-mm2/include/linux/page-flags.h 2008-04-24 00:35:49.649890925 -0700 @@ -86,6 +86,7 @@ enum pageflags { #ifdef CONFIG_PAGEFLAGS_EXTENDED PG_head, /* A head page */ PG_tail, /* A tail page */ + PG_vcompound, /* A virtually mapped compound */ #else PG_compound, /* A compound page */ #endif @@ -266,6 +267,7 @@ static inline void set_page_writeback(st */ __PAGEFLAG(Head, head) __PAGEFLAG(Tail, tail) +__PAGEFLAG(Vcompound, vcompound) static inline int PageCompound(struct page *page) { @@ -309,6 +311,20 @@ static inline void __ClearPageTail(struc page->flags &= ~PG_head_tail_mask; } +#define PG_vcompound_mask ((1L << PG_compound) | (1L << PG_swapcache)) ++#define PageVcompound(page) ((page->flags & PG_vcompound_mask) \ + == PG_vcompound_mask) + +static inline void __SetPageVcompound(struct page *page) +{ + page->flags |= PG_vcompound_mask; +} + +static inline void __ClearPageVcompound(struct page *page) +{ + page->flags &= ~PG_vcompound_mask; +} + #endif /* !PAGEFLAGS_EXTENDED */ #endif /* !__GENERATING_BOUNDS_H */ #endif /* PAGE_FLAGS_H */