mirror of https://gitee.com/openkylin/linux.git
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 <vbabka@suse.cz>
This commit is contained in:
parent
fa417ab750
commit
6c1dbb674c
|
@ -1809,9 +1809,6 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
|
||||||
|
|
||||||
flags &= gfp_allowed_mask;
|
flags &= gfp_allowed_mask;
|
||||||
|
|
||||||
if (gfpflags_allow_blocking(flags))
|
|
||||||
local_irq_enable();
|
|
||||||
|
|
||||||
flags |= s->allocflags;
|
flags |= s->allocflags;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1870,8 +1867,6 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
|
||||||
page->frozen = 1;
|
page->frozen = 1;
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (gfpflags_allow_blocking(flags))
|
|
||||||
local_irq_disable();
|
|
||||||
if (!page)
|
if (!page)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -2812,16 +2807,17 @@ static void *___slab_alloc(struct kmem_cache *s, gfp_t gfpflags, int node,
|
||||||
goto check_new_page;
|
goto check_new_page;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local_irq_restore(flags);
|
||||||
put_cpu_ptr(s->cpu_slab);
|
put_cpu_ptr(s->cpu_slab);
|
||||||
page = new_slab(s, gfpflags, node);
|
page = new_slab(s, gfpflags, node);
|
||||||
c = get_cpu_ptr(s->cpu_slab);
|
c = get_cpu_ptr(s->cpu_slab);
|
||||||
|
|
||||||
if (unlikely(!page)) {
|
if (unlikely(!page)) {
|
||||||
local_irq_restore(flags);
|
|
||||||
slab_out_of_memory(s, gfpflags, node);
|
slab_out_of_memory(s, gfpflags, node);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local_irq_save(flags);
|
||||||
if (c->page)
|
if (c->page)
|
||||||
flush_slab(s, c);
|
flush_slab(s, c);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue