mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ye Liu <ye.liu@linux.dev>
To: Uladzislau Rezki <urezki@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Paul Walmsley <pjw@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>,
	Alexandre Ghiti <alex@ghiti.fr>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	linux-riscv@lists.infradead.org, Ye Liu <liuye@kylinos.cn>
Subject: Re: [PATCH v2 3/3] mm/vmalloc: skip vmalloc_dump_obj for non-vmalloc addresses
Date: Wed, 23 Sep 2026 11:48:45 +0800	[thread overview]
Message-ID: <97c0aabf-872d-46d7-bc98-ab50ea7035a0@linux.dev> (raw)
In-Reply-To: <arJw-VKQNxWA0RSc@milan>



在 2026/9/22 20:13, Uladzislau Rezki 写道:
> On Mon, Sep 21, 2026 at 09:17:23PM +0800, Ye Liu wrote:
>> From: Ye Liu <liuye@kylinos.cn>
>>
>> vmalloc_dump_obj() unconditionally searches all vmap nodes even when
>> called with a non-vmalloc address (e.g. a slab or stack pointer from
>> mem_dump_obj()).  Add an is_vmalloc_or_module_addr() check at the
>> entry to avoid the unnecessary per-node trylock and rb-tree traversal.
>>
>> Use is_vmalloc_or_module_addr() rather than is_vmalloc_addr() because
>> module, BPF, and execmem allocations reside in MODULES_VADDR..MODULES_END
>> on x86_64, arm64, and riscv -- outside VMALLOC_START..VMALLOC_END -- but
>> are still tracked in the same vmap_nodes rb-tree.
>>
>> Signed-off-by: Ye Liu <liuye@kylinos.cn>
>> ---
>>  mm/vmalloc.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/mm/vmalloc.c b/mm/vmalloc.c
>> index 30c610f678dc..d8095b558365 100644
>> --- a/mm/vmalloc.c
>> +++ b/mm/vmalloc.c
>> @@ -5277,6 +5277,9 @@ bool vmalloc_dump_obj(void *object)
>>  	unsigned long addr;
>>  	unsigned long nr_pages;
>>  
>> +	if (!is_vmalloc_or_module_addr(object))
>> +		return false;
>> +
>>  	addr = PAGE_ALIGN_DOWN((unsigned long) object);
>>  
>>  	/*
>>
>> -- 
>> 2.25.1
>>
> Do we need this check? If it is not the vmalloc address, we just return
> noting. Another question is why do you want is_vmalloc_or_module_addr()?
> 
> vmalloc_dump_obj() is about VMALLOC_START..VMALLOC_END, IMO.
> 
> There are only two users of it and both rely on the VMALLOC_START..VMALLOC_END
> range:
> 
> <snip>
> *** mm/kasan/report.c:
> print_address_description[403] if (!vmalloc_dump_obj(addr))
> 
> *** mm/util.c:
> mem_dump_obj[1096]             if (vmalloc_dump_obj(object))
> <snip>
> 
> 	if (is_vmalloc_addr(addr)) {
> 		pr_err("The buggy address belongs to a");
> 		if (!vmalloc_dump_obj(addr))
> 			pr_cont(" vmalloc virtual mapping\n");
> 		page = vmalloc_to_page(addr);
> 	}
> 
> and
> 
> <snip>
> 	if (vmalloc_dump_obj(object))
> 		return;
> 
> 	if (is_vmalloc_addr(object))
> 		type = "vmalloc memory";
> <snip>
> 
> --
> Uladzislau Rezki
Hi Uladzislau,                                                        
                                                                      
You're right that the check is not necessary — without it,            
vmalloc_dump_obj() just returns false for non-vmalloc addresses after 
searching the rb-tree, which is fine for a debug path.                
                                                                      
Regarding is_vmalloc_or_module_addr(): the concern was that module/BPF
allocations are also tracked in vmap_nodes rb-tree (they go through   
__vmalloc_node_range with MODULES_VADDR..MODULES_END), so             
is_vmalloc_addr() would filter them out.  But I agree that            
vmalloc_dump_obj() is about VMALLOC_START..VMALLOC_END, and both      
callers already use is_vmalloc_addr() in their logic.                 
                                                                      
I will drop this patch from v3.  The series will be two patches: the  
alignment fix and the cross-zone lookup fix with the shared           
find_vmap_area_lock() helper.                                         

-- 
Thanks,
Ye Liu


      reply	other threads:[~2026-09-23  3:48 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21 13:17 [PATCH v2 0/3] mm/vmalloc: fix vmalloc_dump_obj VA lookup Ye Liu
2026-09-21 13:17 ` [PATCH v2 1/3] mm/vmalloc: fix vmalloc_dump_obj address alignment for last-page lookups Ye Liu
2026-09-22 12:17   ` Uladzislau Rezki
2026-09-21 13:17 ` [PATCH v2 2/3] mm/vmalloc: fix vmalloc_dump_obj cross-zone VA lookup Ye Liu
2026-09-22 12:44   ` Uladzislau Rezki
2026-09-23  3:39     ` Ye Liu
2026-09-21 13:17 ` [PATCH v2 3/3] mm/vmalloc: skip vmalloc_dump_obj for non-vmalloc addresses Ye Liu
2026-09-22 12:13   ` Uladzislau Rezki
2026-09-23  3:48     ` Ye Liu [this message]

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=97c0aabf-872d-46d7-bc98-ab50ea7035a0@linux.dev \
    --to=ye.liu@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=liuye@kylinos.cn \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=urezki@gmail.com \
    /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

all inboxes | Powered by JetHome®