aboutsummaryrefslogtreecommitdiffstats
path: root/mm/debug-pagealloc.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-12-13 16:00:36 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-12-13 16:00:36 -0500
commit78a45c6f067824cf5d0a9fedea7339ac2e28603c (patch)
treeb4f78c8b6b9059ddace0a18c11629b8d2045f793 /mm/debug-pagealloc.c
parentf96fe225677b3efb74346ebd56fafe3997b02afa (diff)
parent29d293b6007b91a4463f05bc8d0b26e0e65c5816 (diff)
Merge branch 'akpm' (second patch-bomb from Andrew)
Merge second patchbomb from Andrew Morton: - the rest of MM - misc fs fixes - add execveat() syscall - new ratelimit feature for fault-injection - decompressor updates - ipc/ updates - fallocate feature creep - fsnotify cleanups - a few other misc things * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (99 commits) cgroups: Documentation: fix trivial typos and wrong paragraph numberings parisc: percpu: update comments referring to __get_cpu_var percpu: update local_ops.txt to reflect this_cpu operations percpu: remove __get_cpu_var and __raw_get_cpu_var macros fsnotify: remove destroy_list from fsnotify_mark fsnotify: unify inode and mount marks handling fallocate: create FAN_MODIFY and IN_MODIFY events mm/cma: make kmemleak ignore CMA regions slub: fix cpuset check in get_any_partial slab: fix cpuset check in fallback_alloc shmdt: use i_size_read() instead of ->i_size ipc/shm.c: fix overly aggressive shmdt() when calls span multiple segments ipc/msg: increase MSGMNI, remove scaling ipc/sem.c: increase SEMMSL, SEMMNI, SEMOPM ipc/sem.c: change memory barrier in sem_lock() to smp_rmb() lib/decompress.c: consistency of compress formats for kernel image decompress_bunzip2: off by one in get_next_block() usr/Kconfig: make initrd compression algorithm selection not expert fault-inject: add ratelimit option ratelimit: add initialization macro ...
Diffstat (limited to 'mm/debug-pagealloc.c')
-rw-r--r--mm/debug-pagealloc.c45
1 files changed, 40 insertions, 5 deletions
diff --git a/mm/debug-pagealloc.c b/mm/debug-pagealloc.c
index 789ff70c8a4a..5bf5906ce13b 100644
--- a/mm/debug-pagealloc.c
+++ b/mm/debug-pagealloc.c
@@ -2,23 +2,55 @@
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
9static bool page_poisoning_enabled __read_mostly;
10
11static bool need_page_poisoning(void)
12{
13 if (!debug_pagealloc_enabled())
14 return false;
15
16 return true;
17}
18
19static void init_page_poisoning(void)
20{
21 if (!debug_pagealloc_enabled())
22 return;
23
24 page_poisoning_enabled = true;
25}
26
27struct page_ext_operations page_poisoning_ops = {
28 .need = need_page_poisoning,
29 .init = init_page_poisoning,
30};
31
9static inline void set_page_poison(struct page *page) 32static inline void set_page_poison(struct page *page)
10{ 33{
11 __set_bit(PAGE_DEBUG_FLAG_POISON, &page->debug_flags); 34 struct page_ext *page_ext;
35
36 page_ext = lookup_page_ext(page);
37 __set_bit(PAGE_EXT_DEBUG_POISON, &page_ext->flags);
12} 38}
13 39
14static inline void clear_page_poison(struct page *page) 40static inline void clear_page_poison(struct page *page)
15{ 41{
16 __clear_bit(PAGE_DEBUG_FLAG_POISON, &page->debug_flags); 42 struct page_ext *page_ext;
43
44 page_ext = lookup_page_ext(page);
45 __clear_bit(PAGE_EXT_DEBUG_POISON, &page_ext->flags);
17} 46}
18 47
19static inline bool page_poison(struct page *page) 48static inline bool page_poison(struct page *page)
20{ 49{
21 return test_bit(PAGE_DEBUG_FLAG_POISON, &page->debug_flags); 50 struct page_ext *page_ext;
51
52 page_ext = lookup_page_ext(page);
53 return test_bit(PAGE_EXT_DEBUG_POISON, &page_ext->flags);
22} 54}
23 55
24static void poison_page(struct page *page) 56static void poison_page(struct page *page)
@@ -93,8 +125,11 @@ static void unpoison_pages(struct page *page, int n)
93 unpoison_page(page + i); 125 unpoison_page(page + i);
94} 126}
95 127
96void kernel_map_pages(struct page *page, int numpages, int enable) 128void __kernel_map_pages(struct page *page, int numpages, int enable)
97{ 129{
130 if (!page_poisoning_enabled)
131 return;
132
98 if (enable) 133 if (enable)
99 unpoison_pages(page, numpages); 134 unpoison_pages(page, numpages);
100 else 135 else