[lkml]   [2019]   [Jan]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH] mm/slub: use WARN_ON() for some slab errors
From: Miles Chen <>

When debugging with slub.c, sometimes we have to trigger a panic in
order to get the coredump file. To do that, we have to modify slub.c and
rebuild kernel. To make debugging easier, use WARN_ON() for these slab
errors so we can dump stack trace by default or set panic_on_warn to
trigger a panic.

Signed-off-by: Miles Chen <>
mm/slub.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mm/slub.c b/mm/slub.c
index 1e3d0ec4e200..e48c3bb30c93 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -684,7 +684,7 @@ static void print_trailer(struct kmem_cache *s, struct page *page, u8 *p)
print_section(KERN_ERR, "Padding ", p + off,
size_from_object(s) - off);

- dump_stack();
+ WARN_ON(1);

void object_err(struct kmem_cache *s, struct page *page,
@@ -705,7 +705,7 @@ static __printf(3, 4) void slab_err(struct kmem_cache *s, struct page *page,
slab_bug(s, "%s", buf);
- dump_stack();
+ WARN_ON(1);

static void init_object(struct kmem_cache *s, void *object, u8 val)
@@ -1690,7 +1690,7 @@ static struct page *new_slab(struct kmem_cache *s, gfp_t flags, int node)
flags &= ~GFP_SLAB_BUG_MASK;
pr_warn("Unexpected gfp: %#x (%pGg). Fixing up to gfp: %#x (%pGg). Fix your code!\n",
invalid_mask, &invalid_mask, flags, &flags);
- dump_stack();
+ WARN_ON(1);

return allocate_slab(s,
 \ /
  Last update: 2019-01-21 10:39    [W:0.029 / U:25.252 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site