blob: 5042c036dda9fcddcef627743d588f62b5aa4aaf [file] [log] [blame]
Jiri Slaby59ea7462008-06-12 13:56:40 +02001#ifndef LINUX_MM_DEBUG_H
2#define LINUX_MM_DEBUG_H 1
3
Sasha Levin309381fea2014-01-23 15:52:54 -08004struct page;
5
6extern void dump_page(struct page *page, char *reason);
7extern void dump_page_badflags(struct page *page, char *reason,
8 unsigned long badflags);
9
Jiri Slaby59ea7462008-06-12 13:56:40 +020010#ifdef CONFIG_DEBUG_VM
11#define VM_BUG_ON(cond) BUG_ON(cond)
Sasha Levin309381fea2014-01-23 15:52:54 -080012#define VM_BUG_ON_PAGE(cond, page) \
13 do { if (unlikely(cond)) { dump_page(page, NULL); BUG(); } } while (0)
Jiri Slaby59ea7462008-06-12 13:56:40 +020014#else
Konstantin Khlebnikov02602a12012-05-29 15:06:28 -070015#define VM_BUG_ON(cond) BUILD_BUG_ON_INVALID(cond)
Sasha Levin309381fea2014-01-23 15:52:54 -080016#define VM_BUG_ON_PAGE(cond, page) VM_BUG_ON(cond)
Jiri Slaby59ea7462008-06-12 13:56:40 +020017#endif
18
19#ifdef CONFIG_DEBUG_VIRTUAL
20#define VIRTUAL_BUG_ON(cond) BUG_ON(cond)
21#else
Ingo Molnar7aa413d2008-06-19 13:28:11 +020022#define VIRTUAL_BUG_ON(cond) do { } while (0)
Jiri Slaby59ea7462008-06-12 13:56:40 +020023#endif
24
25#endif