]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm, slub: restore irqs around calling new_slab()
authorVlastimil Babka <vbabka@suse.cz>
Mon, 23 Aug 2021 23:58:57 +0000 (09:58 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 25 Aug 2021 23:33:28 +0000 (09:33 +1000)
allocate_slab() currently re-enables irqs before calling to the page
allocator.  It depends on gfpflags_allow_blocking() to determine if it's
safe to do so.  Now we can instead simply restore irq before calling it
through new_slab().  The other caller early_kmem_cache_node_alloc() is
unaffected by this.

Link: https://lkml.kernel.org/r/20210805152000.12817-16-vbabka@suse.cz
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Christoph Lameter <cl@linux.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Jann Horn <jannh@google.com>
Cc: Jesper Dangaard Brouer <brouer@redhat.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
mm/slub.c

index a437730d7ae2491031c2461e35c954d4a39379f7..8b240eb10a1d242bb72c63d326735f1cf389b415 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1795,9 +1795,6 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
 
        flags &= gfp_allowed_mask;
 
-       if (gfpflags_allow_blocking(flags))
-               local_irq_enable();
-
        flags |= s->allocflags;
 
        /*
@@ -1856,8 +1853,6 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
        page->frozen = 1;
 
 out:
-       if (gfpflags_allow_blocking(flags))
-               local_irq_disable();
        if (!page)
                return NULL;
 
@@ -2798,16 +2793,17 @@ new_objects:
                goto check_new_page;
        }
 
+       local_irq_restore(flags);
        put_cpu_ptr(s->cpu_slab);
        page = new_slab(s, gfpflags, node);
        c = get_cpu_ptr(s->cpu_slab);
 
        if (unlikely(!page)) {
-               local_irq_restore(flags);
                slab_out_of_memory(s, gfpflags, node);
                return NULL;
        }
 
+       local_irq_save(flags);
        if (c->page)
                flush_slab(s, c);