aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/page-flags.h
diff options
context:
space:
mode:
authorAndy Whitcroft <apw@shadowen.org>2008-07-24 00:27:16 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-24 13:47:15 -0400
commit0cad47cf13bc2e9142d3a11d9f50523797d0d4ea (patch)
treee0e71528060a11a909f4191738cb3f1abae2e89f /include/linux/page-flags.h
parentda3bbdd4632c0171406b2677e31494afa5bde2f8 (diff)
page-flags: record page flag overlays explicitly
With the recent page flag reorganisation we have a single enum which defines the valid page flags and their values, nice and clear. However there are a number of bits which are overloaded by different subsystems. Firstly there is PG_owner_priv_1 which is used by filesystems and by XEN. Secondly both SLOB and SLUB use a couple of extra page bits to manage internal state for pages they own; both overlay other bits. All of these "aliases" are scattered about the source making it very hard for a reader to know if the bits are safe to rely on in all contexts; confusion here is bad. As we now have a single place where the bits are clearly assigned it makes sense to clarify the reuse of bits by making the aliases explicit and visible with the original bit assignments. This patch creates explicit aliases within the enum itself for the overloaded bits, creates standard bit accessors PageFoo etc. and uses those throughout. This version pulls the bit manipulation out to standard named page bit accessors as suggested by Christoph, it retains the explicit mapping to the overlayed bits. A fusion of both ideas. This has been SLUB and SLOB have been compile tested on x86_64 only, and SLUB boot tested. If people feel this is worth doing then I can run a fuller set of testing. This patch: Some page flags are used for more than one purpose, for example PG_owner_priv_1. Currently there are individual accessors for each user, each built using the common flag name far away from the bit definitions. This makes it hard to see all possible uses of these bits. Now that we have a single enum to generate the bit orders it makes sense to express overlays in the same place. So create per use aliases for this bit in the main page-flags enum and use those in the accessors. [akpm@linux-foundation.org: fix xen] Signed-off-by: Andy Whitcroft <apw@shadowen.org> Cc: Pekka Enberg <penberg@cs.helsinki.fi> Cc: Christoph Lameter <cl@linux-foundation.org> Cc: Matt Mackall <mpm@selenic.com> Cc: Nick Piggin <nickpiggin@yahoo.com.au> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Cc: Rik van Riel <riel@redhat.com> Cc: Jeremy Fitzhardinge <jeremy@goop.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/page-flags.h')
-rw-r--r--include/linux/page-flags.h15
1 files changed, 11 insertions, 4 deletions
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 0d2a4e7012aa..7d8db1233e44 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -96,7 +96,14 @@ enum pageflags {
96#ifdef CONFIG_IA64_UNCACHED_ALLOCATOR 96#ifdef CONFIG_IA64_UNCACHED_ALLOCATOR
97 PG_uncached, /* Page has been mapped as uncached */ 97 PG_uncached, /* Page has been mapped as uncached */
98#endif 98#endif
99 __NR_PAGEFLAGS 99 __NR_PAGEFLAGS,
100
101 /* Filesystems */
102 PG_checked = PG_owner_priv_1,
103
104 /* XEN */
105 PG_pinned = PG_owner_priv_1,
106 PG_savepinned = PG_dirty,
100}; 107};
101 108
102#ifndef __GENERATING_BOUNDS_H 109#ifndef __GENERATING_BOUNDS_H
@@ -155,9 +162,9 @@ PAGEFLAG(Dirty, dirty) TESTSCFLAG(Dirty, dirty) __CLEARPAGEFLAG(Dirty, dirty)
155PAGEFLAG(LRU, lru) __CLEARPAGEFLAG(LRU, lru) 162PAGEFLAG(LRU, lru) __CLEARPAGEFLAG(LRU, lru)
156PAGEFLAG(Active, active) __CLEARPAGEFLAG(Active, active) 163PAGEFLAG(Active, active) __CLEARPAGEFLAG(Active, active)
157__PAGEFLAG(Slab, slab) 164__PAGEFLAG(Slab, slab)
158PAGEFLAG(Checked, owner_priv_1) /* Used by some filesystems */ 165PAGEFLAG(Checked, checked) /* Used by some filesystems */
159PAGEFLAG(Pinned, owner_priv_1) TESTSCFLAG(Pinned, owner_priv_1) /* Xen */ 166PAGEFLAG(Pinned, pinned) TESTSCFLAG(Pinned, pinned) /* Xen */
160PAGEFLAG(SavePinned, dirty); /* Xen */ 167PAGEFLAG(SavePinned, savepinned); /* Xen */
161PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved) 168PAGEFLAG(Reserved, reserved) __CLEARPAGEFLAG(Reserved, reserved)
162PAGEFLAG(Private, private) __CLEARPAGEFLAG(Private, private) 169PAGEFLAG(Private, private) __CLEARPAGEFLAG(Private, private)
163 __SETPAGEFLAG(Private, private) 170 __SETPAGEFLAG(Private, private)