Subversion Repositories Kolibri OS

Rev

Rev 6936 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. #ifndef LINUX_MM_DEBUG_H
  2. #define LINUX_MM_DEBUG_H 1
  3.  
  4. #include <linux/bug.h>
  5. #include <linux/stringify.h>
  6.  
  7. struct page;
  8. struct vm_area_struct;
  9. struct mm_struct;
  10.  
  11. extern void dump_page(struct page *page, const char *reason);
  12. extern void __dump_page(struct page *page, const char *reason);
  13. void dump_vma(const struct vm_area_struct *vma);
  14. void dump_mm(const struct mm_struct *mm);
  15.  
  16. #ifdef CONFIG_DEBUG_VM
  17. #define VM_BUG_ON(cond) BUG_ON(cond)
  18. #define VM_BUG_ON_PAGE(cond, page)                                      \
  19.         do {                                                            \
  20.                 if (unlikely(cond)) {                                   \
  21.                         dump_page(page, "VM_BUG_ON_PAGE(" __stringify(cond)")");\
  22.                         BUG();                                          \
  23.                 }                                                       \
  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)
  39. #define VM_WARN_ON(cond) WARN_ON(cond)
  40. #define VM_WARN_ON_ONCE(cond) WARN_ON_ONCE(cond)
  41. #define VM_WARN_ONCE(cond, format...) WARN_ONCE(cond, format)
  42. #else
  43. #define VM_BUG_ON(cond) BUILD_BUG_ON_INVALID(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)
  47. #define VM_WARN_ON(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)
  50. #endif
  51.  
  52. #ifdef CONFIG_DEBUG_VIRTUAL
  53. #define VIRTUAL_BUG_ON(cond) BUG_ON(cond)
  54. #else
  55. #define VIRTUAL_BUG_ON(cond) do { } while (0)
  56. #endif
  57.  
  58. #ifdef CONFIG_DEBUG_VM_PGFLAGS
  59. #define VM_BUG_ON_PGFLAGS(cond, page) VM_BUG_ON_PAGE(cond, page)
  60. #else
  61. #define VM_BUG_ON_PGFLAGS(cond, page) BUILD_BUG_ON_INVALID(cond)
  62. #endif
  63.  
  64. #endif
  65.