mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Tiezhu Yang <yangtiezhu@loongson.cn>
Cc: Mike Rapoport <rppt@kernel.org>,
	Huacai Chen <chenhuacai@kernel.org>,
	linux-mm@kvack.org, loongarch@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 1/2] mm/execmem: Print size, align and caller on allocation failure
Date: Fri, 17 Jul 2026 11:37:30 -0700	[thread overview]
Message-ID: <20260717113730.787867964b1c3a7c645bb0e0@linux-foundation.org> (raw)
In-Reply-To: <20260717075715.25513-2-yangtiezhu@loongson.cn>

On Fri, 17 Jul 2026 15:57:14 +0800 Tiezhu Yang <yangtiezhu@loongson.cn> wrote:

> The current execmem_vmalloc() function reports an allocation failure
> with a simplistic "unable to allocate memory" message. This notifies
> the user that an error occurred, but it acts as a black box during
> debugging.
> 
> Enhance pr_warn_ratelimited() within execmem_vmalloc() to explicitly
> print the requested allocation size, alignment constraints, and the
> symbolic caller.
> 
> This diagnostic visibility is valuable for analyzing the root cause
> of allocation failures and tracking misbehaving subsystems without
> inducing log pollution.

Have you actually encountered this?  GFP_KERNEL allocation failures are
supposed to be very rare.

> ...
>
> --- a/mm/execmem.c
> +++ b/mm/execmem.c
> @@ -50,7 +50,9 @@ static void *execmem_vmalloc(struct execmem_range *range, size_t size,
>  	}
>  
>  	if (!p) {
> -		pr_warn_ratelimited("unable to allocate memory\n");
> +		pr_warn_ratelimited("unable to allocate memory, "
> +				    "size=%zu, align=%u, caller is %pS\n",
> +				     size, align, __builtin_return_address(0));
>  		return NULL;
>  	}

This seems to be duplicating the information which the page allocator
can emit.  Perhaps we should remove the __GFP_NOWARN in there?

  reply	other threads:[~2026-07-17 18:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-17  7:57 [PATCH v1 0/2] Enhance execmem diagnostic and fix LoongArch module bottleneck Tiezhu Yang
2026-07-17  7:57 ` [PATCH v1 1/2] mm/execmem: Print size, align and caller on allocation failure Tiezhu Yang
2026-07-17 18:37   ` Andrew Morton [this message]
2026-07-17  7:57 ` [PATCH v1 2/2] LoongArch: mm: Expand modules virtual address space to 2GB Tiezhu Yang

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=20260717113730.787867964b1c3a7c645bb0e0@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=chenhuacai@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=loongarch@lists.linux.dev \
    --cc=rppt@kernel.org \
    --cc=yangtiezhu@loongson.cn \
    /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