linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dennis Zhou <dennis@kernel.org>
To: Baoquan He <bhe@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	akpm@linux-foundation.org, tj@kernel.org, cl@linux.com,
	mawupeng1@huawei.com
Subject: Re: [PATCH 3/3] mm/percpu.c: print error message too if atomic alloc failed
Date: Fri, 21 Jul 2023 14:03:00 -0700	[thread overview]
Message-ID: <ZLryhIzyDUpEPUzT@snowbird> (raw)
In-Reply-To: <20230721131800.20003-4-bhe@redhat.com>

On Fri, Jul 21, 2023 at 09:18:00PM +0800, Baoquan He wrote:
> The variable 'err' is assgigned to an error message if atomic alloc
> failed, while it has no chance to be printed if is_atomic is true.
> 
> Here change to print error message too if atomic alloc failed, while
> avoid to call dump_stack() if that case.
> 
> Signed-off-by: Baoquan He <bhe@redhat.com>
> ---
>  mm/percpu.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/percpu.c b/mm/percpu.c
> index c25b058a46ad..74f75ef0ad58 100644
> --- a/mm/percpu.c
> +++ b/mm/percpu.c
> @@ -1890,13 +1890,15 @@ static void __percpu *pcpu_alloc(size_t size, size_t align, bool reserved,
>  fail:
>  	trace_percpu_alloc_percpu_fail(reserved, is_atomic, size, align);
>  
> -	if (!is_atomic && do_warn && warn_limit) {
> +	if (do_warn && warn_limit) {
>  		pr_warn("allocation failed, size=%zu align=%zu atomic=%d, %s\n",
>  			size, align, is_atomic, err);
> -		dump_stack();
> +		if (is_atomic)
> +			dump_stack();

This should be (!is_atomic) to preserve the current logic?

>  		if (!--warn_limit)
>  			pr_info("limit reached, disable warning\n");
>  	}
> +
>  	if (is_atomic) {
>  		/* see the flag handling in pcpu_balance_workfn() */
>  		pcpu_atomic_alloc_failed = true;
> -- 
> 2.34.1
> 

Thanks,
Dennis


  reply	other threads:[~2023-07-21 21:03 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-21 13:17 [PATCH 0/3] percpu: some trivial cleanup patches Baoquan He
2023-07-21 13:17 ` [PATCH 1/3] mm/percpu.c: remove redundant check Baoquan He
2023-07-21 20:55   ` Dennis Zhou
2023-07-21 13:17 ` [PATCH 2/3] mm/percpu.c: optimize the code in pcpu_setup_first_chunk() a little bit Baoquan He
2023-07-21 21:01   ` Dennis Zhou
2023-07-22  1:14     ` Baoquan He
2023-07-21 13:18 ` [PATCH 3/3] mm/percpu.c: print error message too if atomic alloc failed Baoquan He
2023-07-21 21:03   ` Dennis Zhou [this message]
2023-07-22  1:56     ` Baoquan He
2023-07-21 21:04 ` [PATCH 0/3] percpu: some trivial cleanup patches Dennis Zhou
2023-07-22  3:30   ` Baoquan He
2023-07-27 22:50     ` Dennis Zhou
2023-07-28  3:04       ` Baoquan He

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=ZLryhIzyDUpEPUzT@snowbird \
    --to=dennis@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=bhe@redhat.com \
    --cc=cl@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mawupeng1@huawei.com \
    --cc=tj@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).