diff options
author | Dave Hansen <dave.hansen@linux.intel.com> | 2014-06-04 19:07:02 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-06-04 19:53:58 -0400 |
commit | e4f674229ce63dac60be0c4ddfb5ef8d1225d30d (patch) | |
tree | dc271d2e95ab57c72db32978de7e2a24924e1ea9 | |
parent | 3dae7fec5e884a4e72e5416db0894de66f586201 (diff) |
mm: pass VM_BUG_ON() reason to dump_page()
I recently added a patch to let folks pass a "reason" string dump_page()
which gets dumped out along with the page's data. This essentially
saves the bug-reader a trip in to the source to figure out why we
BUG_ON()'d.
The new VM_BUG_ON_PAGE() passes in NULL for "reason". It seems like we
might as well pass the BUG_ON() condition if we have it. This will
bloat kernels a bit with ~160 new strings, but this is all under a
debugging option anyway.
page:ffffea0008560280 count:1 mapcount:0 mapping:(null) index:0x0
page flags: 0xbfffc0000000001(locked)
page dumped because: VM_BUG_ON_PAGE(PageLocked(page))
------------[ cut here ]------------
kernel BUG at /home/davehans/linux.git/mm/filemap.c:464!
invalid opcode: 0000 [#1] SMP
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.14.0+ #251
Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
...
[akpm@linux-foundation.org: include stringify.h]
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: Davidlohr Bueso <davidlohr@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | include/linux/mmdebug.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h index a3499d7b0e8a..edd82a105220 100644 --- a/include/linux/mmdebug.h +++ b/include/linux/mmdebug.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef LINUX_MM_DEBUG_H | 1 | #ifndef LINUX_MM_DEBUG_H |
2 | #define LINUX_MM_DEBUG_H 1 | 2 | #define LINUX_MM_DEBUG_H 1 |
3 | 3 | ||
4 | #include <linux/stringify.h> | ||
5 | |||
4 | struct page; | 6 | struct page; |
5 | 7 | ||
6 | extern void dump_page(struct page *page, const char *reason); | 8 | extern void dump_page(struct page *page, const char *reason); |
@@ -9,8 +11,13 @@ extern void dump_page_badflags(struct page *page, const char *reason, | |||
9 | 11 | ||
10 | #ifdef CONFIG_DEBUG_VM | 12 | #ifdef CONFIG_DEBUG_VM |
11 | #define VM_BUG_ON(cond) BUG_ON(cond) | 13 | #define VM_BUG_ON(cond) BUG_ON(cond) |
12 | #define VM_BUG_ON_PAGE(cond, page) \ | 14 | #define VM_BUG_ON_PAGE(cond, page) \ |
13 | do { if (unlikely(cond)) { dump_page(page, NULL); BUG(); } } while (0) | 15 | do { \ |
16 | if (unlikely(cond)) { \ | ||
17 | dump_page(page, "VM_BUG_ON_PAGE(" __stringify(cond)")");\ | ||
18 | BUG(); \ | ||
19 | } \ | ||
20 | } while (0) | ||
14 | #define VM_WARN_ON(cond) WARN_ON(cond) | 21 | #define VM_WARN_ON(cond) WARN_ON(cond) |
15 | #define VM_WARN_ON_ONCE(cond) WARN_ON_ONCE(cond) | 22 | #define VM_WARN_ON_ONCE(cond) WARN_ON_ONCE(cond) |
16 | #else | 23 | #else |