diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/mm.h | 19 | ||||
-rw-r--r-- | include/linux/mm_types.h | 4 | ||||
-rw-r--r-- | include/linux/page-debug-flags.h | 32 | ||||
-rw-r--r-- | include/linux/page_ext.h | 15 |
4 files changed, 33 insertions, 37 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h index 3b337efbe533..66560f1a0564 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/bit_spinlock.h> | 19 | #include <linux/bit_spinlock.h> |
20 | #include <linux/shrinker.h> | 20 | #include <linux/shrinker.h> |
21 | #include <linux/resource.h> | 21 | #include <linux/resource.h> |
22 | #include <linux/page_ext.h> | ||
22 | 23 | ||
23 | struct mempolicy; | 24 | struct mempolicy; |
24 | struct anon_vma; | 25 | struct anon_vma; |
@@ -2155,20 +2156,36 @@ extern void copy_user_huge_page(struct page *dst, struct page *src, | |||
2155 | unsigned int pages_per_huge_page); | 2156 | unsigned int pages_per_huge_page); |
2156 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */ | 2157 | #endif /* CONFIG_TRANSPARENT_HUGEPAGE || CONFIG_HUGETLBFS */ |
2157 | 2158 | ||
2159 | extern struct page_ext_operations debug_guardpage_ops; | ||
2160 | extern struct page_ext_operations page_poisoning_ops; | ||
2161 | |||
2158 | #ifdef CONFIG_DEBUG_PAGEALLOC | 2162 | #ifdef CONFIG_DEBUG_PAGEALLOC |
2159 | extern unsigned int _debug_guardpage_minorder; | 2163 | extern unsigned int _debug_guardpage_minorder; |
2164 | extern bool _debug_guardpage_enabled; | ||
2160 | 2165 | ||
2161 | static inline unsigned int debug_guardpage_minorder(void) | 2166 | static inline unsigned int debug_guardpage_minorder(void) |
2162 | { | 2167 | { |
2163 | return _debug_guardpage_minorder; | 2168 | return _debug_guardpage_minorder; |
2164 | } | 2169 | } |
2165 | 2170 | ||
2171 | static inline bool debug_guardpage_enabled(void) | ||
2172 | { | ||
2173 | return _debug_guardpage_enabled; | ||
2174 | } | ||
2175 | |||
2166 | static inline bool page_is_guard(struct page *page) | 2176 | static inline bool page_is_guard(struct page *page) |
2167 | { | 2177 | { |
2168 | return test_bit(PAGE_DEBUG_FLAG_GUARD, &page->debug_flags); | 2178 | struct page_ext *page_ext; |
2179 | |||
2180 | if (!debug_guardpage_enabled()) | ||
2181 | return false; | ||
2182 | |||
2183 | page_ext = lookup_page_ext(page); | ||
2184 | return test_bit(PAGE_EXT_DEBUG_GUARD, &page_ext->flags); | ||
2169 | } | 2185 | } |
2170 | #else | 2186 | #else |
2171 | static inline unsigned int debug_guardpage_minorder(void) { return 0; } | 2187 | static inline unsigned int debug_guardpage_minorder(void) { return 0; } |
2188 | static inline bool debug_guardpage_enabled(void) { return false; } | ||
2172 | static inline bool page_is_guard(struct page *page) { return false; } | 2189 | static inline bool page_is_guard(struct page *page) { return false; } |
2173 | #endif /* CONFIG_DEBUG_PAGEALLOC */ | 2190 | #endif /* CONFIG_DEBUG_PAGEALLOC */ |
2174 | 2191 | ||
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index fc2daffa9db1..6d34aa266a8c 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h | |||
@@ -10,7 +10,6 @@ | |||
10 | #include <linux/rwsem.h> | 10 | #include <linux/rwsem.h> |
11 | #include <linux/completion.h> | 11 | #include <linux/completion.h> |
12 | #include <linux/cpumask.h> | 12 | #include <linux/cpumask.h> |
13 | #include <linux/page-debug-flags.h> | ||
14 | #include <linux/uprobes.h> | 13 | #include <linux/uprobes.h> |
15 | #include <linux/page-flags-layout.h> | 14 | #include <linux/page-flags-layout.h> |
16 | #include <asm/page.h> | 15 | #include <asm/page.h> |
@@ -186,9 +185,6 @@ struct page { | |||
186 | void *virtual; /* Kernel virtual address (NULL if | 185 | void *virtual; /* Kernel virtual address (NULL if |
187 | not kmapped, ie. highmem) */ | 186 | not kmapped, ie. highmem) */ |
188 | #endif /* WANT_PAGE_VIRTUAL */ | 187 | #endif /* WANT_PAGE_VIRTUAL */ |
189 | #ifdef CONFIG_WANT_PAGE_DEBUG_FLAGS | ||
190 | unsigned long debug_flags; /* Use atomic bitops on this */ | ||
191 | #endif | ||
192 | 188 | ||
193 | #ifdef CONFIG_KMEMCHECK | 189 | #ifdef CONFIG_KMEMCHECK |
194 | /* | 190 | /* |
diff --git a/include/linux/page-debug-flags.h b/include/linux/page-debug-flags.h deleted file mode 100644 index 22691f614043..000000000000 --- a/include/linux/page-debug-flags.h +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | #ifndef LINUX_PAGE_DEBUG_FLAGS_H | ||
2 | #define LINUX_PAGE_DEBUG_FLAGS_H | ||
3 | |||
4 | /* | ||
5 | * page->debug_flags bits: | ||
6 | * | ||
7 | * PAGE_DEBUG_FLAG_POISON is set for poisoned pages. This is used to | ||
8 | * implement generic debug pagealloc feature. The pages are filled with | ||
9 | * poison patterns and set this flag after free_pages(). The poisoned | ||
10 | * pages are verified whether the patterns are not corrupted and clear | ||
11 | * the flag before alloc_pages(). | ||
12 | */ | ||
13 | |||
14 | enum page_debug_flags { | ||
15 | PAGE_DEBUG_FLAG_POISON, /* Page is poisoned */ | ||
16 | PAGE_DEBUG_FLAG_GUARD, | ||
17 | }; | ||
18 | |||
19 | /* | ||
20 | * Ensure that CONFIG_WANT_PAGE_DEBUG_FLAGS reliably | ||
21 | * gets turned off when no debug features are enabling it! | ||
22 | */ | ||
23 | |||
24 | #ifdef CONFIG_WANT_PAGE_DEBUG_FLAGS | ||
25 | #if !defined(CONFIG_PAGE_POISONING) && \ | ||
26 | !defined(CONFIG_PAGE_GUARD) \ | ||
27 | /* && !defined(CONFIG_PAGE_DEBUG_SOMETHING_ELSE) && ... */ | ||
28 | #error WANT_PAGE_DEBUG_FLAGS is turned on with no debug features! | ||
29 | #endif | ||
30 | #endif /* CONFIG_WANT_PAGE_DEBUG_FLAGS */ | ||
31 | |||
32 | #endif /* LINUX_PAGE_DEBUG_FLAGS_H */ | ||
diff --git a/include/linux/page_ext.h b/include/linux/page_ext.h index 2ccc8b414e5c..61c0f05f9069 100644 --- a/include/linux/page_ext.h +++ b/include/linux/page_ext.h | |||
@@ -10,6 +10,21 @@ struct page_ext_operations { | |||
10 | #ifdef CONFIG_PAGE_EXTENSION | 10 | #ifdef CONFIG_PAGE_EXTENSION |
11 | 11 | ||
12 | /* | 12 | /* |
13 | * page_ext->flags bits: | ||
14 | * | ||
15 | * PAGE_EXT_DEBUG_POISON is set for poisoned pages. This is used to | ||
16 | * implement generic debug pagealloc feature. The pages are filled with | ||
17 | * poison patterns and set this flag after free_pages(). The poisoned | ||
18 | * pages are verified whether the patterns are not corrupted and clear | ||
19 | * the flag before alloc_pages(). | ||
20 | */ | ||
21 | |||
22 | enum page_ext_flags { | ||
23 | PAGE_EXT_DEBUG_POISON, /* Page is poisoned */ | ||
24 | PAGE_EXT_DEBUG_GUARD, | ||
25 | }; | ||
26 | |||
27 | /* | ||
13 | * Page Extension can be considered as an extended mem_map. | 28 | * Page Extension can be considered as an extended mem_map. |
14 | * A page_ext page is associated with every page descriptor. The | 29 | * A page_ext page is associated with every page descriptor. The |
15 | * page_ext helps us add more information about the page. | 30 | * page_ext helps us add more information about the page. |