Skip to content

Commit 9f101ee

Browse files
committed
mm, slub: check new pages with restored irqs
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. Signed-off-by: Vlastimil Babka <[email protected]>
1 parent 3f2b77e commit 9f101ee

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

mm/slub.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,8 +1009,6 @@ static int check_slab(struct kmem_cache *s, struct page *page)
10091009
{
10101010
int maxobj;
10111011

1012-
VM_BUG_ON(!irqs_disabled());
1013-
10141012
if (!PageSlab(page)) {
10151013
slab_err(s, page, "Not a valid slab page");
10161014
return 0;
@@ -2802,10 +2800,10 @@ static void *___slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node,
28022800
lockdep_assert_irqs_disabled();
28032801

28042802
freelist = get_partial(s, gfpflags, node, &page);
2803+
local_irq_restore(flags);
28052804
if (freelist)
28062805
goto check_new_page;
28072806

2808-
local_irq_restore(flags);
28092807
put_cpu_ptr(s->cpu_slab);
28102808
page = new_slab(s, gfpflags, node);
28112809
c = get_cpu_ptr(s->cpu_slab);
@@ -2815,7 +2813,6 @@ static void *___slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node,
28152813
return NULL;
28162814
}
28172815

2818-
local_irq_save(flags);
28192816
/*
28202817
* No other reference to the page yet so we can
28212818
* muck around with it freely without cmpxchg
@@ -2830,7 +2827,6 @@ static void *___slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node,
28302827
if (kmem_cache_debug(s)) {
28312828
if (!alloc_debug_processing(s, page, freelist, addr)) {
28322829
/* Slab failed checks. Next slab needed */
2833-
local_irq_restore(flags);
28342830
goto new_slab;
28352831
} else {
28362832
/*
@@ -2848,6 +2844,7 @@ static void *___slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node,
28482844
*/
28492845
goto return_single;
28502846

2847+
local_irq_save(flags);
28512848
if (unlikely(c->page))
28522849
flush_slab(s, c);
28532850
c->page = page;
@@ -2856,6 +2853,7 @@ static void *___slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node,
28562853

28572854
return_single:
28582855

2856+
local_irq_save(flags);
28592857
if (unlikely(c->page))
28602858
flush_slab(s, c);
28612859
c->page = page;

0 commit comments

Comments
 (0)