]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - include/linux/mmdebug.h
mm/hotplug: invalid PFNs from pfn_to_online_page()
[mirror_ubuntu-bionic-kernel.git] / include / linux / mmdebug.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
59ea7463
JS
2#ifndef LINUX_MM_DEBUG_H
3#define LINUX_MM_DEBUG_H 1
4
1d5cda40 5#include <linux/bug.h>
e4f67422
DH
6#include <linux/stringify.h>
7
309381fe 8struct page;
0bf55139 9struct vm_area_struct;
31c9afa6 10struct mm_struct;
309381fe 11
d230dec1 12extern void dump_page(struct page *page, const char *reason);
ff8e8116 13extern void __dump_page(struct page *page, const char *reason);
0bf55139 14void dump_vma(const struct vm_area_struct *vma);
31c9afa6 15void dump_mm(const struct mm_struct *mm);
309381fe 16
59ea7463
JS
17#ifdef CONFIG_DEBUG_VM
18#define VM_BUG_ON(cond) BUG_ON(cond)
e4f67422
DH
19#define VM_BUG_ON_PAGE(cond, page) \
20 do { \
21 if (unlikely(cond)) { \
22 dump_page(page, "VM_BUG_ON_PAGE(" __stringify(cond)")");\
23 BUG(); \
24 } \
25 } while (0)
fa3759cc
SL
26#define VM_BUG_ON_VMA(cond, vma) \
27 do { \
28 if (unlikely(cond)) { \
29 dump_vma(vma); \
30 BUG(); \
31 } \
32 } while (0)
31c9afa6
SL
33#define VM_BUG_ON_MM(cond, mm) \
34 do { \
35 if (unlikely(cond)) { \
36 dump_mm(mm); \
37 BUG(); \
38 } \
39 } while (0)
02a8efed
AM
40#define VM_WARN_ON(cond) WARN_ON(cond)
41#define VM_WARN_ON_ONCE(cond) WARN_ON_ONCE(cond)
ef6b571f 42#define VM_WARN_ONCE(cond, format...) WARN_ONCE(cond, format)
a54f9aeb 43#define VM_WARN(cond, format...) WARN(cond, format)
59ea7463 44#else
02602a18 45#define VM_BUG_ON(cond) BUILD_BUG_ON_INVALID(cond)
309381fe 46#define VM_BUG_ON_PAGE(cond, page) VM_BUG_ON(cond)
fa3759cc 47#define VM_BUG_ON_VMA(cond, vma) VM_BUG_ON(cond)
31c9afa6 48#define VM_BUG_ON_MM(cond, mm) VM_BUG_ON(cond)
02a8efed
AM
49#define VM_WARN_ON(cond) BUILD_BUG_ON_INVALID(cond)
50#define VM_WARN_ON_ONCE(cond) BUILD_BUG_ON_INVALID(cond)
ef6b571f 51#define VM_WARN_ONCE(cond, format...) BUILD_BUG_ON_INVALID(cond)
a54f9aeb 52#define VM_WARN(cond, format...) BUILD_BUG_ON_INVALID(cond)
59ea7463
JS
53#endif
54
55#ifdef CONFIG_DEBUG_VIRTUAL
56#define VIRTUAL_BUG_ON(cond) BUG_ON(cond)
57#else
7aa413de 58#define VIRTUAL_BUG_ON(cond) do { } while (0)
59ea7463
JS
59#endif
60
95ad9755
KS
61#ifdef CONFIG_DEBUG_VM_PGFLAGS
62#define VM_BUG_ON_PGFLAGS(cond, page) VM_BUG_ON_PAGE(cond, page)
63#else
64#define VM_BUG_ON_PGFLAGS(cond, page) BUILD_BUG_ON_INVALID(cond)
65#endif
66
59ea7463 67#endif