diff options
Diffstat (limited to 'mm/debug-pagealloc.c')
-rw-r--r-- | mm/debug-pagealloc.c | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/mm/debug-pagealloc.c b/mm/debug-pagealloc.c index 789ff70c8a4a..0072f2c53331 100644 --- a/mm/debug-pagealloc.c +++ b/mm/debug-pagealloc.c | |||
@@ -2,23 +2,49 @@ | |||
2 | #include <linux/string.h> | 2 | #include <linux/string.h> |
3 | #include <linux/mm.h> | 3 | #include <linux/mm.h> |
4 | #include <linux/highmem.h> | 4 | #include <linux/highmem.h> |
5 | #include <linux/page-debug-flags.h> | 5 | #include <linux/page_ext.h> |
6 | #include <linux/poison.h> | 6 | #include <linux/poison.h> |
7 | #include <linux/ratelimit.h> | 7 | #include <linux/ratelimit.h> |
8 | 8 | ||
9 | static bool page_poisoning_enabled __read_mostly; | ||
10 | |||
11 | static bool need_page_poisoning(void) | ||
12 | { | ||
13 | return true; | ||
14 | } | ||
15 | |||
16 | static void init_page_poisoning(void) | ||
17 | { | ||
18 | page_poisoning_enabled = true; | ||
19 | } | ||
20 | |||
21 | struct page_ext_operations page_poisoning_ops = { | ||
22 | .need = need_page_poisoning, | ||
23 | .init = init_page_poisoning, | ||
24 | }; | ||
25 | |||
9 | static inline void set_page_poison(struct page *page) | 26 | static inline void set_page_poison(struct page *page) |
10 | { | 27 | { |
11 | __set_bit(PAGE_DEBUG_FLAG_POISON, &page->debug_flags); | 28 | struct page_ext *page_ext; |
29 | |||
30 | page_ext = lookup_page_ext(page); | ||
31 | __set_bit(PAGE_EXT_DEBUG_POISON, &page_ext->flags); | ||
12 | } | 32 | } |
13 | 33 | ||
14 | static inline void clear_page_poison(struct page *page) | 34 | static inline void clear_page_poison(struct page *page) |
15 | { | 35 | { |
16 | __clear_bit(PAGE_DEBUG_FLAG_POISON, &page->debug_flags); | 36 | struct page_ext *page_ext; |
37 | |||
38 | page_ext = lookup_page_ext(page); | ||
39 | __clear_bit(PAGE_EXT_DEBUG_POISON, &page_ext->flags); | ||
17 | } | 40 | } |
18 | 41 | ||
19 | static inline bool page_poison(struct page *page) | 42 | static inline bool page_poison(struct page *page) |
20 | { | 43 | { |
21 | return test_bit(PAGE_DEBUG_FLAG_POISON, &page->debug_flags); | 44 | struct page_ext *page_ext; |
45 | |||
46 | page_ext = lookup_page_ext(page); | ||
47 | return test_bit(PAGE_EXT_DEBUG_POISON, &page_ext->flags); | ||
22 | } | 48 | } |
23 | 49 | ||
24 | static void poison_page(struct page *page) | 50 | static void poison_page(struct page *page) |
@@ -95,6 +121,9 @@ static void unpoison_pages(struct page *page, int n) | |||
95 | 121 | ||
96 | void kernel_map_pages(struct page *page, int numpages, int enable) | 122 | void kernel_map_pages(struct page *page, int numpages, int enable) |
97 | { | 123 | { |
124 | if (!page_poisoning_enabled) | ||
125 | return; | ||
126 | |||
98 | if (enable) | 127 | if (enable) |
99 | unpoison_pages(page, numpages); | 128 | unpoison_pages(page, numpages); |
100 | else | 129 | else |