linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Liwei Song <liwei.song@windriver.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: linux-rt <linux-rt-users@vger.kernel.org>,
	Mike Galbraith <efault@gmx.de>
Subject: Re: [PATCH RT] mm: Don't warn about atomic memory allocations during suspend
Date: Tue, 5 May 2020 11:59:29 +0800	[thread overview]
Message-ID: <a24d2165-a2d2-b63e-36a0-7dc9d6a0cf06@windriver.com> (raw)
In-Reply-To: <20200504145325.3rjc3iskg2coejje@linutronix.de>



On 5/4/20 22:53, Sebastian Andrzej Siewior wrote:
> From: Liwei Song <liwei.song@windriver.com>
> 
> 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@windriver.com>
> [bigeasy: commit description, allocate_slab() hunk]
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> ---
> 
> 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);
> 

      reply	other threads:[~2020-05-05  4:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-13  4:18 [PATCH RT] mm: do not warn for suspend when allocate memory on RT Liwei Song
2020-04-16 17:09 ` Sebastian Andrzej Siewior
2020-04-17  2:50   ` Liwei Song
2020-04-21 14:51     ` Sebastian Andrzej Siewior
2020-04-24  9:09       ` Liwei Song
2020-05-04 14:53         ` [PATCH RT] mm: Don't warn about atomic memory allocations during suspend Sebastian Andrzej Siewior
2020-05-05  3:59           ` Liwei Song [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a24d2165-a2d2-b63e-36a0-7dc9d6a0cf06@windriver.com \
    --to=liwei.song@windriver.com \
    --cc=bigeasy@linutronix.de \
    --cc=efault@gmx.de \
    --cc=linux-rt-users@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).