]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm/slub: use stackdepot to save stack trace in objects-fix
authorVlastimil Babka <vbabka@suse.cz>
Wed, 2 Jun 2021 03:53:25 +0000 (13:53 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 3 Jun 2021 08:17:02 +0000 (18:17 +1000)
Paul reports [1] lockdep splat HARDIRQ-safe -> HARDIRQ-unsafe lock order
detected.  Kernel test robot reports [2]
BUG:sleeping_function_called_from_invalid_context_at_mm/page_alloc.c

The stack trace might be saved from contexts where we can't block so GFP_KERNEL
is unsafe. So use GFP_NOWAIT. Under memory pressure we might thus fail to save
some new unique stack, but that should be extremely rare.

[1] https://lore.kernel.org/linux-mm/20210515204622.GA2672367@paulmck-ThinkPad-P17-Gen-1/
[2] https://lore.kernel.org/linux-mm/20210516144152.GA25903@xsang-OptiPlex-9020/

Link: https://lkml.kernel.org/r/20210516195150.26740-1-vbabka@suse.cz
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Reported-by: Paul E. McKenney <paulmck@kernel.org>
Tested-by: Paul E. McKenney <paulmck@kernel.org>
Reported-by: kernel test robot <oliver.sang@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
mm/slub.c

index e37f58882fb39be905ee6c3f1e47031aada22a6e..2bfaa9c42e5b53156c80add32888e5c63d08cc65 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -638,7 +638,7 @@ static void set_track(struct kmem_cache *s, void *object,
 
        if (addr) {
 #ifdef CONFIG_STACKDEPOT
-               p->handle = save_stack_depot_trace(GFP_KERNEL);
+               p->handle = save_stack_depot_trace(GFP_NOWAIT);
 #endif
                p->addr = addr;
                p->cpu = smp_processor_id();