aboutsummaryrefslogtreecommitdiffstats
path: root/mm/debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/debug.c')
-rw-r--r--mm/debug.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/mm/debug.c b/mm/debug.c
index bd10aad8539a..cdacba12e09a 100644
--- a/mm/debug.c
+++ b/mm/debug.c
@@ -13,6 +13,7 @@
13#include <trace/events/mmflags.h> 13#include <trace/events/mmflags.h>
14#include <linux/migrate.h> 14#include <linux/migrate.h>
15#include <linux/page_owner.h> 15#include <linux/page_owner.h>
16#include <linux/ctype.h>
16 17
17#include "internal.h" 18#include "internal.h"
18 19
@@ -175,4 +176,49 @@ void dump_mm(const struct mm_struct *mm)
175 ); 176 );
176} 177}
177 178
179static bool page_init_poisoning __read_mostly = true;
180
181static int __init setup_vm_debug(char *str)
182{
183 bool __page_init_poisoning = true;
184
185 /*
186 * Calling vm_debug with no arguments is equivalent to requesting
187 * to enable all debugging options we can control.
188 */
189 if (*str++ != '=' || !*str)
190 goto out;
191
192 __page_init_poisoning = false;
193 if (*str == '-')
194 goto out;
195
196 while (*str) {
197 switch (tolower(*str)) {
198 case'p':
199 __page_init_poisoning = true;
200 break;
201 default:
202 pr_err("vm_debug option '%c' unknown. skipped\n",
203 *str);
204 }
205
206 str++;
207 }
208out:
209 if (page_init_poisoning && !__page_init_poisoning)
210 pr_warn("Page struct poisoning disabled by kernel command line option 'vm_debug'\n");
211
212 page_init_poisoning = __page_init_poisoning;
213
214 return 1;
215}
216__setup("vm_debug", setup_vm_debug);
217
218void page_init_poison(struct page *page, size_t size)
219{
220 if (page_init_poisoning)
221 memset(page, PAGE_POISON_PATTERN, size);
222}
223EXPORT_SYMBOL_GPL(page_init_poison);
178#endif /* CONFIG_DEBUG_VM */ 224#endif /* CONFIG_DEBUG_VM */