Skip to content

Commit 6c1dbb6

Browse files
committed
mm, slub: restore irqs around calling new_slab()
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. Signed-off-by: Vlastimil Babka <[email protected]>
1 parent fa417ab commit 6c1dbb6

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

mm/slub.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1809,9 +1809,6 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
18091809

18101810
flags &= gfp_allowed_mask;
18111811

1812-
if (gfpflags_allow_blocking(flags))
1813-
local_irq_enable();
1814-
18151812
flags |= s->allocflags;
18161813

18171814
/*
@@ -1870,8 +1867,6 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
18701867
page->frozen = 1;
18711868

18721869
out:
1873-
if (gfpflags_allow_blocking(flags))
1874-
local_irq_disable();
18751870
if (!page)
18761871
return NULL;
18771872

@@ -2812,16 +2807,17 @@ static void *___slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node,
28122807
goto check_new_page;
28132808
}
28142809

2810+
local_irq_restore(flags);
28152811
put_cpu_ptr(s->cpu_slab);
28162812
page = new_slab(s, gfpflags, node);
28172813
c = get_cpu_ptr(s->cpu_slab);
28182814

28192815
if (unlikely(!page)) {
2820-
local_irq_restore(flags);
28212816
slab_out_of_memory(s, gfpflags, node);
28222817
return NULL;
28232818
}
28242819

2820+
local_irq_save(flags);
28252821
if (c->page)
28262822
flush_slab(s, c);
28272823

0 commit comments

Comments
 (0)