aboutsummaryrefslogtreecommitdiffstats
path: root/mm/debug-pagealloc.c
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2011-10-31 20:08:38 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-10-31 20:30:48 -0400
commit64212ec569bfdd094f7a23d9b09862209a983559 (patch)
treeaf9a80c08795e602c5a6401fa3599562c2b6be48 /mm/debug-pagealloc.c
parent3ee9a4f086716d792219c021e8509f91165a4128 (diff)
debug-pagealloc: add support for highmem pages
This adds support for highmem pages poisoning and verification to the debug-pagealloc feature for no-architecture support. [akpm@linux-foundation.org: remove unneeded preempt_disable/enable] Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/debug-pagealloc.c')
-rw-r--r--mm/debug-pagealloc.c44
1 files changed, 10 insertions, 34 deletions
diff --git a/mm/debug-pagealloc.c b/mm/debug-pagealloc.c
index 2618933efdb3..7cea557407f4 100644
--- a/mm/debug-pagealloc.c
+++ b/mm/debug-pagealloc.c
@@ -1,6 +1,7 @@
1#include <linux/kernel.h> 1#include <linux/kernel.h>
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/page-debug-flags.h> 5#include <linux/page-debug-flags.h>
5#include <linux/poison.h> 6#include <linux/poison.h>
6#include <linux/ratelimit.h> 7#include <linux/ratelimit.h>
@@ -20,28 +21,13 @@ static inline bool page_poison(struct page *page)
20 return test_bit(PAGE_DEBUG_FLAG_POISON, &page->debug_flags); 21 return test_bit(PAGE_DEBUG_FLAG_POISON, &page->debug_flags);
21} 22}
22 23
23static void poison_highpage(struct page *page)
24{
25 /*
26 * Page poisoning for highmem pages is not implemented.
27 *
28 * This can be called from interrupt contexts.
29 * So we need to create a new kmap_atomic slot for this
30 * application and it will need interrupt protection.
31 */
32}
33
34static void poison_page(struct page *page) 24static void poison_page(struct page *page)
35{ 25{
36 void *addr; 26 void *addr = kmap_atomic(page);
37 27
38 if (PageHighMem(page)) {
39 poison_highpage(page);
40 return;
41 }
42 set_page_poison(page); 28 set_page_poison(page);
43 addr = page_address(page);
44 memset(addr, PAGE_POISON, PAGE_SIZE); 29 memset(addr, PAGE_POISON, PAGE_SIZE);
30 kunmap_atomic(addr);
45} 31}
46 32
47static void poison_pages(struct page *page, int n) 33static void poison_pages(struct page *page, int n)
@@ -86,27 +72,17 @@ static void check_poison_mem(unsigned char *mem, size_t bytes)
86 dump_stack(); 72 dump_stack();
87} 73}
88 74
89static void unpoison_highpage(struct page *page)
90{
91 /*
92 * See comment in poison_highpage().
93 * Highmem pages should not be poisoned for now
94 */
95 BUG_ON(page_poison(page));
96}
97
98static void unpoison_page(struct page *page) 75static void unpoison_page(struct page *page)
99{ 76{
100 if (PageHighMem(page)) { 77 void *addr;
101 unpoison_highpage(page); 78
79 if (!page_poison(page))
102 return; 80 return;
103 }
104 if (page_poison(page)) {
105 void *addr = page_address(page);
106 81
107 check_poison_mem(addr, PAGE_SIZE); 82 addr = kmap_atomic(page);
108 clear_page_poison(page); 83 check_poison_mem(addr, PAGE_SIZE);
109 } 84 clear_page_poison(page);
85 kunmap_atomic(addr);
110} 86}
111 87
112static void unpoison_pages(struct page *page, int n) 88static void unpoison_pages(struct page *page, int n)