diff options
Diffstat (limited to 'include/linux/mmdebug.h')
| -rw-r--r-- | include/linux/mmdebug.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h index edd82a105220..877ef226f90f 100644 --- a/include/linux/mmdebug.h +++ b/include/linux/mmdebug.h | |||
| @@ -4,10 +4,14 @@ | |||
| 4 | #include <linux/stringify.h> | 4 | #include <linux/stringify.h> |
| 5 | 5 | ||
| 6 | struct page; | 6 | struct page; |
| 7 | struct vm_area_struct; | ||
| 8 | struct mm_struct; | ||
| 7 | 9 | ||
| 8 | extern void dump_page(struct page *page, const char *reason); | 10 | extern void dump_page(struct page *page, const char *reason); |
| 9 | extern void dump_page_badflags(struct page *page, const char *reason, | 11 | extern void dump_page_badflags(struct page *page, const char *reason, |
| 10 | unsigned long badflags); | 12 | unsigned long badflags); |
| 13 | void dump_vma(const struct vm_area_struct *vma); | ||
| 14 | void dump_mm(const struct mm_struct *mm); | ||
| 11 | 15 | ||
| 12 | #ifdef CONFIG_DEBUG_VM | 16 | #ifdef CONFIG_DEBUG_VM |
| 13 | #define VM_BUG_ON(cond) BUG_ON(cond) | 17 | #define VM_BUG_ON(cond) BUG_ON(cond) |
| @@ -18,13 +22,31 @@ extern void dump_page_badflags(struct page *page, const char *reason, | |||
| 18 | BUG(); \ | 22 | BUG(); \ |
| 19 | } \ | 23 | } \ |
| 20 | } while (0) | 24 | } while (0) |
| 25 | #define VM_BUG_ON_VMA(cond, vma) \ | ||
| 26 | do { \ | ||
| 27 | if (unlikely(cond)) { \ | ||
| 28 | dump_vma(vma); \ | ||
| 29 | BUG(); \ | ||
| 30 | } \ | ||
| 31 | } while (0) | ||
| 32 | #define VM_BUG_ON_MM(cond, mm) \ | ||
| 33 | do { \ | ||
| 34 | if (unlikely(cond)) { \ | ||
| 35 | dump_mm(mm); \ | ||
| 36 | BUG(); \ | ||
| 37 | } \ | ||
| 38 | } while (0) | ||
| 21 | #define VM_WARN_ON(cond) WARN_ON(cond) | 39 | #define VM_WARN_ON(cond) WARN_ON(cond) |
| 22 | #define VM_WARN_ON_ONCE(cond) WARN_ON_ONCE(cond) | 40 | #define VM_WARN_ON_ONCE(cond) WARN_ON_ONCE(cond) |
| 41 | #define VM_WARN_ONCE(cond, format...) WARN_ONCE(cond, format) | ||
| 23 | #else | 42 | #else |
| 24 | #define VM_BUG_ON(cond) BUILD_BUG_ON_INVALID(cond) | 43 | #define VM_BUG_ON(cond) BUILD_BUG_ON_INVALID(cond) |
| 25 | #define VM_BUG_ON_PAGE(cond, page) VM_BUG_ON(cond) | 44 | #define VM_BUG_ON_PAGE(cond, page) VM_BUG_ON(cond) |
| 45 | #define VM_BUG_ON_VMA(cond, vma) VM_BUG_ON(cond) | ||
| 46 | #define VM_BUG_ON_MM(cond, mm) VM_BUG_ON(cond) | ||
| 26 | #define VM_WARN_ON(cond) BUILD_BUG_ON_INVALID(cond) | 47 | #define VM_WARN_ON(cond) BUILD_BUG_ON_INVALID(cond) |
| 27 | #define VM_WARN_ON_ONCE(cond) BUILD_BUG_ON_INVALID(cond) | 48 | #define VM_WARN_ON_ONCE(cond) BUILD_BUG_ON_INVALID(cond) |
| 49 | #define VM_WARN_ONCE(cond, format...) BUILD_BUG_ON_INVALID(cond) | ||
| 28 | #endif | 50 | #endif |
| 29 | 51 | ||
| 30 | #ifdef CONFIG_DEBUG_VIRTUAL | 52 | #ifdef CONFIG_DEBUG_VIRTUAL |
