On 5/4/20 22:53, Sebastian Andrzej Siewior wrote: > From: Liwei Song <liwei.song@xxxxxxxxxxxxx> > > The ACPI code allocates larger amount of memory during resume. This > triggers a warning because the allocation happens with disabled > interrupts. > At this stage only one CPU is active so there should be no lock > contention. If SLUB needs to call into the buddy allocator for more > memory then it should not enable interrupts. > > Limit the check to system state with more CPUs and scheduling and only > enable interrupts in SLUB at this stage. > > Signed-off-by: Liwei Song <liwei.song@xxxxxxxxxxxxx> > [bigeasy: commit description, allocate_slab() hunk] > Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx> > --- > > Are you okay with this Liwei? Yes, I'm fine with this, thanks for your help. Liwei. > > mm/slub.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/mm/slub.c b/mm/slub.c > index 15c194ff16e6e..6ea1057edf1ab 100644 > --- a/mm/slub.c > +++ b/mm/slub.c > @@ -1655,7 +1655,7 @@ static struct page *allocate_slab(struct kmem_cache *s, gfp_t flags, int node) > enableirqs = true; > > #ifdef CONFIG_PREEMPT_RT > - if (system_state > SYSTEM_BOOTING) > + if (system_state > SYSTEM_BOOTING && system_state < SYSTEM_SUSPEND) > enableirqs = true; > #endif > if (enableirqs) > @@ -2771,7 +2771,8 @@ static __always_inline void *slab_alloc_node(struct kmem_cache *s, > unsigned long tid; > > if (IS_ENABLED(CONFIG_PREEMPT_RT) && IS_ENABLED(CONFIG_DEBUG_ATOMIC_SLEEP)) > - WARN_ON_ONCE(!preemptible() && system_state >= SYSTEM_SCHEDULING); > + WARN_ON_ONCE(!preemptible() && > + (system_state > SYSTEM_BOOTING && system_state < SYSTEM_SUSPEND)); > > s = slab_pre_alloc_hook(s, gfpflags); > if (!s) > @@ -3236,7 +3237,8 @@ int kmem_cache_alloc_bulk(struct kmem_cache *s, gfp_t flags, size_t size, > int i; > > if (IS_ENABLED(CONFIG_PREEMPT_RT) && IS_ENABLED(CONFIG_DEBUG_ATOMIC_SLEEP)) > - WARN_ON_ONCE(!preemptible() && system_state >= SYSTEM_SCHEDULING); > + WARN_ON_ONCE(!preemptible() && > + (system_state > SYSTEM_BOOTING && system_state < SYSTEM_SUSPEND)); > > /* memcg and kmem_cache debug support */ > s = slab_pre_alloc_hook(s, flags); >