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

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.

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
 mm/execmem.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mm/execmem.c b/mm/execmem.c
index 084a207e4278..f3bc68e0eb98 100644
--- 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;
 	}
 
-- 
2.42.0


  reply	other threads:[~2026-07-17  7:57 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 ` Tiezhu Yang [this message]
2026-07-17 18:37   ` [PATCH v1 1/2] mm/execmem: Print size, align and caller on allocation failure Andrew Morton
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=20260717075715.25513-2-yangtiezhu@loongson.cn \
    --to=yangtiezhu@loongson.cn \
    --cc=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 \
    /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