diff options
-rw-r--r-- | fs/proc/page.c | 45 | ||||
-rw-r--r-- | include/linux/kernel-page-flags.h | 46 | ||||
-rw-r--r-- | include/linux/page-flags.h | 2 |
3 files changed, 51 insertions, 42 deletions
diff --git a/fs/proc/page.c b/fs/proc/page.c index 5033ce0d254b..180cf5a0bd67 100644 --- a/fs/proc/page.c +++ b/fs/proc/page.c | |||
@@ -8,6 +8,7 @@ | |||
8 | #include <linux/proc_fs.h> | 8 | #include <linux/proc_fs.h> |
9 | #include <linux/seq_file.h> | 9 | #include <linux/seq_file.h> |
10 | #include <linux/hugetlb.h> | 10 | #include <linux/hugetlb.h> |
11 | #include <linux/kernel-page-flags.h> | ||
11 | #include <asm/uaccess.h> | 12 | #include <asm/uaccess.h> |
12 | #include "internal.h" | 13 | #include "internal.h" |
13 | 14 | ||
@@ -71,52 +72,12 @@ static const struct file_operations proc_kpagecount_operations = { | |||
71 | * physical page flags. | 72 | * physical page flags. |
72 | */ | 73 | */ |
73 | 74 | ||
74 | /* These macros are used to decouple internal flags from exported ones */ | ||
75 | |||
76 | #define KPF_LOCKED 0 | ||
77 | #define KPF_ERROR 1 | ||
78 | #define KPF_REFERENCED 2 | ||
79 | #define KPF_UPTODATE 3 | ||
80 | #define KPF_DIRTY 4 | ||
81 | #define KPF_LRU 5 | ||
82 | #define KPF_ACTIVE 6 | ||
83 | #define KPF_SLAB 7 | ||
84 | #define KPF_WRITEBACK 8 | ||
85 | #define KPF_RECLAIM 9 | ||
86 | #define KPF_BUDDY 10 | ||
87 | |||
88 | /* 11-20: new additions in 2.6.31 */ | ||
89 | #define KPF_MMAP 11 | ||
90 | #define KPF_ANON 12 | ||
91 | #define KPF_SWAPCACHE 13 | ||
92 | #define KPF_SWAPBACKED 14 | ||
93 | #define KPF_COMPOUND_HEAD 15 | ||
94 | #define KPF_COMPOUND_TAIL 16 | ||
95 | #define KPF_HUGE 17 | ||
96 | #define KPF_UNEVICTABLE 18 | ||
97 | #define KPF_HWPOISON 19 | ||
98 | #define KPF_NOPAGE 20 | ||
99 | |||
100 | #define KPF_KSM 21 | ||
101 | |||
102 | /* kernel hacking assistances | ||
103 | * WARNING: subject to change, never rely on them! | ||
104 | */ | ||
105 | #define KPF_RESERVED 32 | ||
106 | #define KPF_MLOCKED 33 | ||
107 | #define KPF_MAPPEDTODISK 34 | ||
108 | #define KPF_PRIVATE 35 | ||
109 | #define KPF_PRIVATE_2 36 | ||
110 | #define KPF_OWNER_PRIVATE 37 | ||
111 | #define KPF_ARCH 38 | ||
112 | #define KPF_UNCACHED 39 | ||
113 | |||
114 | static inline u64 kpf_copy_bit(u64 kflags, int ubit, int kbit) | 75 | static inline u64 kpf_copy_bit(u64 kflags, int ubit, int kbit) |
115 | { | 76 | { |
116 | return ((kflags >> kbit) & 1) << ubit; | 77 | return ((kflags >> kbit) & 1) << ubit; |
117 | } | 78 | } |
118 | 79 | ||
119 | static u64 get_uflags(struct page *page) | 80 | u64 stable_page_flags(struct page *page) |
120 | { | 81 | { |
121 | u64 k; | 82 | u64 k; |
122 | u64 u; | 83 | u64 u; |
@@ -219,7 +180,7 @@ static ssize_t kpageflags_read(struct file *file, char __user *buf, | |||
219 | else | 180 | else |
220 | ppage = NULL; | 181 | ppage = NULL; |
221 | 182 | ||
222 | if (put_user(get_uflags(ppage), out)) { | 183 | if (put_user(stable_page_flags(ppage), out)) { |
223 | ret = -EFAULT; | 184 | ret = -EFAULT; |
224 | break; | 185 | break; |
225 | } | 186 | } |
diff --git a/include/linux/kernel-page-flags.h b/include/linux/kernel-page-flags.h new file mode 100644 index 000000000000..bd92a89f4b0a --- /dev/null +++ b/include/linux/kernel-page-flags.h | |||
@@ -0,0 +1,46 @@ | |||
1 | #ifndef LINUX_KERNEL_PAGE_FLAGS_H | ||
2 | #define LINUX_KERNEL_PAGE_FLAGS_H | ||
3 | |||
4 | /* | ||
5 | * Stable page flag bits exported to user space | ||
6 | */ | ||
7 | |||
8 | #define KPF_LOCKED 0 | ||
9 | #define KPF_ERROR 1 | ||
10 | #define KPF_REFERENCED 2 | ||
11 | #define KPF_UPTODATE 3 | ||
12 | #define KPF_DIRTY 4 | ||
13 | #define KPF_LRU 5 | ||
14 | #define KPF_ACTIVE 6 | ||
15 | #define KPF_SLAB 7 | ||
16 | #define KPF_WRITEBACK 8 | ||
17 | #define KPF_RECLAIM 9 | ||
18 | #define KPF_BUDDY 10 | ||
19 | |||
20 | /* 11-20: new additions in 2.6.31 */ | ||
21 | #define KPF_MMAP 11 | ||
22 | #define KPF_ANON 12 | ||
23 | #define KPF_SWAPCACHE 13 | ||
24 | #define KPF_SWAPBACKED 14 | ||
25 | #define KPF_COMPOUND_HEAD 15 | ||
26 | #define KPF_COMPOUND_TAIL 16 | ||
27 | #define KPF_HUGE 17 | ||
28 | #define KPF_UNEVICTABLE 18 | ||
29 | #define KPF_HWPOISON 19 | ||
30 | #define KPF_NOPAGE 20 | ||
31 | |||
32 | #define KPF_KSM 21 | ||
33 | |||
34 | /* kernel hacking assistances | ||
35 | * WARNING: subject to change, never rely on them! | ||
36 | */ | ||
37 | #define KPF_RESERVED 32 | ||
38 | #define KPF_MLOCKED 33 | ||
39 | #define KPF_MAPPEDTODISK 34 | ||
40 | #define KPF_PRIVATE 35 | ||
41 | #define KPF_PRIVATE_2 36 | ||
42 | #define KPF_OWNER_PRIVATE 37 | ||
43 | #define KPF_ARCH 38 | ||
44 | #define KPF_UNCACHED 39 | ||
45 | |||
46 | #endif /* LINUX_KERNEL_PAGE_FLAGS_H */ | ||
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index f9df6308af95..feee2ba8d06a 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h | |||
@@ -282,6 +282,8 @@ PAGEFLAG_FALSE(HWPoison) | |||
282 | #define __PG_HWPOISON 0 | 282 | #define __PG_HWPOISON 0 |
283 | #endif | 283 | #endif |
284 | 284 | ||
285 | u64 stable_page_flags(struct page *page); | ||
286 | |||
285 | static inline int PageUptodate(struct page *page) | 287 | static inline int PageUptodate(struct page *page) |
286 | { | 288 | { |
287 | int ret = test_bit(PG_uptodate, &(page)->flags); | 289 | int ret = test_bit(PG_uptodate, &(page)->flags); |