Re: [PATCH v1 1/2] mm/execmem: Print size, align and caller on allocation failure
Andrew Morton <[email protected]> Fri, 17 Jul 2026 11:37:30 -0700
| Newsgroups | dev.linux.lists.loongarch,org.kernel.vger.linux-kernel,org.kvack.linux-mm |
|---|---|
| Message-ID | <[email protected]> |
On Fri, 17 Jul 2026 15:57:14 +0800 Tiezhu Yang <[email protected]> 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?