blob: 2d57efa64cc168e5a033ace8079c102b9269fa6b [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
Kirill A. Shutemovd230dec2014-04-07 15:37:38 -07006extern void dump_page(struct page *page, const char *reason);
7extern void dump_page_badflags(struct page *page, const char *reason,
Sasha Levin309381fea2014-01-23 15:52:54 -08008 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