Jiri Slaby | 59ea746 | 2008-06-12 13:56:40 +0200 | [diff] [blame] | 1 | #ifndef LINUX_MM_DEBUG_H |
| 2 | #define LINUX_MM_DEBUG_H 1 |
| 3 | |
Sasha Levin | 309381fea | 2014-01-23 15:52:54 -0800 | [diff] [blame] | 4 | struct page; |
| 5 | |
| 6 | extern void dump_page(struct page *page, char *reason); |
| 7 | extern void dump_page_badflags(struct page *page, char *reason, |
| 8 | unsigned long badflags); |
| 9 | |
Jiri Slaby | 59ea746 | 2008-06-12 13:56:40 +0200 | [diff] [blame] | 10 | #ifdef CONFIG_DEBUG_VM |
| 11 | #define VM_BUG_ON(cond) BUG_ON(cond) |
Sasha Levin | 309381fea | 2014-01-23 15:52:54 -0800 | [diff] [blame] | 12 | #define VM_BUG_ON_PAGE(cond, page) \ |
| 13 | do { if (unlikely(cond)) { dump_page(page, NULL); BUG(); } } while (0) |
Jiri Slaby | 59ea746 | 2008-06-12 13:56:40 +0200 | [diff] [blame] | 14 | #else |
Konstantin Khlebnikov | 02602a1 | 2012-05-29 15:06:28 -0700 | [diff] [blame] | 15 | #define VM_BUG_ON(cond) BUILD_BUG_ON_INVALID(cond) |
Sasha Levin | 309381fea | 2014-01-23 15:52:54 -0800 | [diff] [blame] | 16 | #define VM_BUG_ON_PAGE(cond, page) VM_BUG_ON(cond) |
Jiri Slaby | 59ea746 | 2008-06-12 13:56:40 +0200 | [diff] [blame] | 17 | #endif |
| 18 | |
| 19 | #ifdef CONFIG_DEBUG_VIRTUAL |
| 20 | #define VIRTUAL_BUG_ON(cond) BUG_ON(cond) |
| 21 | #else |
Ingo Molnar | 7aa413d | 2008-06-19 13:28:11 +0200 | [diff] [blame] | 22 | #define VIRTUAL_BUG_ON(cond) do { } while (0) |
Jiri Slaby | 59ea746 | 2008-06-12 13:56:40 +0200 | [diff] [blame] | 23 | #endif |
| 24 | |
| 25 | #endif |