The patch titled Subject: mm/slub: introduce SLAB_WARN_ON_ERROR has been removed from the -mm tree. Its filename was mm-slub-introduce-slab_warn_on_error.patch This patch was dropped because it was nacked ------------------------------------------------------ From: Miles Chen <miles.chen@xxxxxxxxxxxx> Subject: mm/slub: introduce SLAB_WARN_ON_ERROR When debugging slab errors in slub.c, sometimes we have to trigger a panic in order to get the coredump file. Add a debug option SLAB_WARN_ON_ERROR to toggle WARN_ON() when the option is set. [akpm@xxxxxxxxxxxxxxxxxxxx: Documentation/vm/slub.rst: avoid misleading use of the word "toggle"] Link: http://lkml.kernel.org/r/1548313223-17114-1-git-send-email-miles.chen@xxxxxxxxxxxx Signed-off-by: Miles Chen <miles.chen@xxxxxxxxxxxx> Reviewed-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Cc: Christopher Lameter <cl@xxxxxxxxx> Cc: Pekka Enberg <penberg@xxxxxxxxxx>, Cc: David Rientjes <rientjes@xxxxxxxxxx>, Cc: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx>, Cc: Jonathan Corbet <corbet@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- Documentation/vm/slub.rst | 3 ++- include/linux/slab.h | 3 +++ mm/slub.c | 34 ++++++++++++++++++++++++++++++++-- 3 files changed, 37 insertions(+), 3 deletions(-) --- a/Documentation/vm/slub.rst~mm-slub-introduce-slab_warn_on_error +++ a/Documentation/vm/slub.rst @@ -49,9 +49,10 @@ Possible debug options are:: P Poisoning (object and padding) U User tracking (free and alloc) T Trace (please only use on single slabs) - A Toggle failslab filter mark for the cache + A Enable/disable failslab filter mark for the cache O Switch debugging off for caches that would have caused higher minimum slab orders + W Enable/disable WARN_ON() on slab errors - Switch all debugging off (useful if the kernel is configured with CONFIG_SLUB_DEBUG_ON) --- a/include/linux/slab.h~mm-slub-introduce-slab_warn_on_error +++ a/include/linux/slab.h @@ -109,6 +109,9 @@ #define SLAB_KASAN 0 #endif +/* WARN_ON slab error */ +#define SLAB_WARN_ON_ERROR ((slab_flags_t __force)0x10000000U) + /* The following flags affect the page allocator grouping pages by mobility */ /* Objects are reclaimable */ #define SLAB_RECLAIM_ACCOUNT ((slab_flags_t __force)0x00020000U) --- a/mm/slub.c~mm-slub-introduce-slab_warn_on_error +++ a/mm/slub.c @@ -691,7 +691,10 @@ static void print_trailer(struct kmem_ca print_section(KERN_ERR, "Padding ", p + off, size_from_object(s) - off); - dump_stack(); + if (unlikely(s->flags & SLAB_WARN_ON_ERROR)) + WARN_ON(1); + else + dump_stack(); } void object_err(struct kmem_cache *s, struct page *page, @@ -712,7 +715,11 @@ static __printf(3, 4) void slab_err(stru va_end(args); slab_bug(s, "%s", buf); print_page_info(page); - dump_stack(); + + if (unlikely(s->flags & SLAB_WARN_ON_ERROR)) + WARN_ON(1); + else + dump_stack(); } static void init_object(struct kmem_cache *s, void *object, u8 val) @@ -1271,6 +1278,9 @@ static int __init setup_slub_debug(char case 'a': slub_debug |= SLAB_FAILSLAB; break; + case 'w': + slub_debug |= SLAB_WARN_ON_ERROR; + break; case 'o': /* * Avoid enabling debugging on caches if its minimum @@ -5238,6 +5248,25 @@ static ssize_t store_user_store(struct k } SLAB_ATTR(store_user); +static ssize_t warn_on_error_show(struct kmem_cache *s, char *buf) +{ + return sprintf(buf, "%d\n", !!(s->flags & SLAB_WARN_ON_ERROR)); +} + +static ssize_t warn_on_error_store(struct kmem_cache *s, + const char *buf, size_t length) +{ + if (any_slab_objects(s)) + return -EBUSY; + + s->flags &= ~SLAB_WARN_ON_ERROR; + if (buf[0] == '1') + s->flags |= SLAB_WARN_ON_ERROR; + + return length; +} +SLAB_ATTR(warn_on_error); + static ssize_t validate_show(struct kmem_cache *s, char *buf) { return 0; @@ -5446,6 +5475,7 @@ static struct attribute *slab_attrs[] = &validate_attr.attr, &alloc_calls_attr.attr, &free_calls_attr.attr, + &warn_on_error_attr.attr, #endif #ifdef CONFIG_ZONE_DMA &cache_dma_attr.attr, _ Patches currently in -mm which might be from miles.chen@xxxxxxxxxxxx are