Skip to content

Commit

Permalink
slub: Enable irqs for __GFP_WAIT
Browse files Browse the repository at this point in the history
SYSTEM_RUNNING might be too late for enabling interrupts. Allocations
with GFP_WAIT can happen before that. So use this as an indicator.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
KAGA-KOKO authored and Sebastian Andrzej Siewior committed Nov 24, 2017
1 parent 1969d46 commit 0d5b5ea
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -1572,14 +1572,17 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
void *start, *p;
int idx, order;
bool shuffle;
bool enableirqs = false;

flags &= gfp_allowed_mask;

if (gfpflags_allow_blocking(flags))
enableirqs = true;
#ifdef CONFIG_PREEMPT_RT_FULL
if (system_state > SYSTEM_BOOTING)
#else
if (gfpflags_allow_blocking(flags))
enableirqs = true;
#endif
if (enableirqs)
local_irq_enable();

flags |= s->allocflags;
Expand Down Expand Up @@ -1654,11 +1657,7 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
page->frozen = 1;

out:
#ifdef CONFIG_PREEMPT_RT_FULL
if (system_state > SYSTEM_BOOTING)
#else
if (gfpflags_allow_blocking(flags))
#endif
if (enableirqs)
local_irq_disable();
if (!page)
return NULL;
Expand Down

0 comments on commit 0d5b5ea

Please sign in to comment.