* [PATCH] mm/vmalloc: add alignment info in warning print as possible failure reason
@ 2026-07-02 11:26 Feng Tang
2026-07-02 17:48 ` Uladzislau Rezki
0 siblings, 1 reply; 2+ messages in thread
From: Feng Tang @ 2026-07-02 11:26 UTC (permalink / raw)
To: Andrew Morton, Uladzislau Rezki; +Cc: linux-mm, linux-kernel, Feng Tang
When running 'fix_align_alloc_test' case of test_vmalloc module with
command:
insmod ./test_vmalloc.ko run_test_mask=64
It will fail, which is the expected result, as the case increment
the alignment parameter gradually to 64bit limit. And the dmesg has
warning msg:
"vmalloc_test/0: vmalloc error: size 4096, vm_struct allocation failed, mode:0xdc0(GFP_KERNEL|__GFP_ZERO), nodemask=(null),cpuset=/,mems_allowed=0"
It doesn't give the alignment info, which is the real reason for the
failure (not the 'size').
Add alignment info to the warning print to give the necessary hint
for possible failure reason, and the message will be:
"vmalloc_test/0: vmalloc error: size 4096, align 0x800000000000, vm_struct allocation failed, mode:0xdc0(GFP_KERNEL|__GFP_ZERO), nodemask=(null),cpuset=/,mems_allowed=0"
Signed-off-by: Feng Tang <feng.tang@linux.alibaba.com>
---
mm/vmalloc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 1afca3568b9b..e066324dcc76 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -4045,8 +4045,8 @@ void *__vmalloc_node_range_noprof(unsigned long size, unsigned long align,
if (!area) {
bool nofail = gfp_mask & __GFP_NOFAIL;
warn_alloc(gfp_mask, NULL,
- "vmalloc error: size %lu, vm_struct allocation failed%s",
- size, (nofail) ? ". Retrying." : "");
+ "vmalloc error: size %lu, align 0x%lx, vm_struct allocation failed%s",
+ size, align, (nofail) ? ". Retrying." : "");
if (nofail) {
schedule_timeout_uninterruptible(1);
goto again;
--
2.43.5
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] mm/vmalloc: add alignment info in warning print as possible failure reason
2026-07-02 11:26 [PATCH] mm/vmalloc: add alignment info in warning print as possible failure reason Feng Tang
@ 2026-07-02 17:48 ` Uladzislau Rezki
0 siblings, 0 replies; 2+ messages in thread
From: Uladzislau Rezki @ 2026-07-02 17:48 UTC (permalink / raw)
To: Feng Tang; +Cc: Andrew Morton, Uladzislau Rezki, linux-mm, linux-kernel
On Thu, Jul 02, 2026 at 07:26:10PM +0800, Feng Tang wrote:
> When running 'fix_align_alloc_test' case of test_vmalloc module with
> command:
> insmod ./test_vmalloc.ko run_test_mask=64
>
> It will fail, which is the expected result, as the case increment
> the alignment parameter gradually to 64bit limit. And the dmesg has
> warning msg:
> "vmalloc_test/0: vmalloc error: size 4096, vm_struct allocation failed, mode:0xdc0(GFP_KERNEL|__GFP_ZERO), nodemask=(null),cpuset=/,mems_allowed=0"
>
> It doesn't give the alignment info, which is the real reason for the
> failure (not the 'size').
>
> Add alignment info to the warning print to give the necessary hint
> for possible failure reason, and the message will be:
> "vmalloc_test/0: vmalloc error: size 4096, align 0x800000000000, vm_struct allocation failed, mode:0xdc0(GFP_KERNEL|__GFP_ZERO), nodemask=(null),cpuset=/,mems_allowed=0"
>
> Signed-off-by: Feng Tang <feng.tang@linux.alibaba.com>
> ---
> mm/vmalloc.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
> index 1afca3568b9b..e066324dcc76 100644
> --- a/mm/vmalloc.c
> +++ b/mm/vmalloc.c
> @@ -4045,8 +4045,8 @@ void *__vmalloc_node_range_noprof(unsigned long size, unsigned long align,
> if (!area) {
> bool nofail = gfp_mask & __GFP_NOFAIL;
> warn_alloc(gfp_mask, NULL,
> - "vmalloc error: size %lu, vm_struct allocation failed%s",
> - size, (nofail) ? ". Retrying." : "");
> + "vmalloc error: size %lu, align 0x%lx, vm_struct allocation failed%s",
> + size, align, (nofail) ? ". Retrying." : "");
> if (nofail) {
> schedule_timeout_uninterruptible(1);
> goto again;
> --
> 2.43.5
>
Do not see any issues with adding extra information on failure.
Reviewed-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
--
Uladzislau Rezki
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-02 17:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-02 11:26 [PATCH] mm/vmalloc: add alignment info in warning print as possible failure reason Feng Tang
2026-07-02 17:48 ` Uladzislau Rezki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox