]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm, slub: check new pages with restored irqs
authorVlastimil Babka <vbabka@suse.cz>
Mon, 23 Aug 2021 23:58:58 +0000 (09:58 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 25 Aug 2021 23:33:28 +0000 (09:33 +1000)
Building on top of the previous patch, re-enable irqs before checking new
pages.  alloc_debug_processing() is now called with enabled irqs so we
need to remove VM_BUG_ON(!irqs_disabled()); in check_slab() - there
doesn't seem to be a need for it anyway.

Link: https://lkml.kernel.org/r/20210805152000.12817-18-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 fddfb0629b8ee1a4f992e5816d832e8de56eb076..d5ac278084cfb5a2ea8a05ffea5b53aa28ff9178 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -995,8 +995,6 @@ static int check_slab(struct kmem_cache *s, struct page *page)
 {
        int maxobj;
 
-       VM_BUG_ON(!irqs_disabled());
-
        if (!PageSlab(page)) {
                slab_err(s, page, "Not a valid slab page");
                return 0;
@@ -2788,10 +2786,10 @@ new_objects:
        lockdep_assert_irqs_disabled();
 
        freelist = get_partial(s, gfpflags, node, &page);
+       local_irq_restore(flags);
        if (freelist)
                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);
@@ -2801,7 +2799,6 @@ new_objects:
                return NULL;
        }
 
-       local_irq_save(flags);
        /*
         * No other reference to the page yet so we can
         * muck around with it freely without cmpxchg
@@ -2816,7 +2813,6 @@ check_new_page:
        if (kmem_cache_debug(s)) {
                if (!alloc_debug_processing(s, page, freelist, addr)) {
                        /* Slab failed checks. Next slab needed */
-                       local_irq_restore(flags);
                        goto new_slab;
                } else {
                        /*
@@ -2834,6 +2830,7 @@ check_new_page:
                 */
                goto return_single;
 
+       local_irq_save(flags);
        if (unlikely(c->page))
                flush_slab(s, c);
        c->page = page;
@@ -2842,6 +2839,7 @@ check_new_page:
 
 return_single:
 
+       local_irq_save(flags);
        if (unlikely(c->page))
                flush_slab(s, c);
        c->page = page;