Subject: Re: [GIT PULL] Networking for v6.13-rc7

From: Catalin Marinas <[email-masked]>
Date: Mon, 20 Jan 2025 14:51:13 +0000

On Sat, Jan 18, 2025 at 01:45:18PM +0000, Catalin Marinas wrote:
> On Thu, Jan 16, 2025 at 07:38:21PM -0800, Jakub Kicinski wrote:
> > After 76d5d4c53e68 ("mm/kmemleak: fix percpu memory leak detection
> > failure") we get this on every instance of our testing VMs:
> > 
> > unreferenced object 0x00042aa0 (size 64):
> >   comm "swapper/0", pid 0, jiffies 4294667296
> >   hex dump (first 32 bytes on cpu 2):
> >     00 00 00 00 00 00 00 00 00 00 06 00 00 00 00 00  ................
> >     00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
> >   backtrace (crc 0):
> >     pcpu_alloc_noprof+0x4ad/0xab0
> >     setup_zone_pageset+0x30/0x290
> >     setup_per_cpu_pageset+0x6a/0x1f0
> >     start_kernel+0x2a4/0x410
> >     x86_64_start_reservations+0x18/0x30
> >     x86_64_start_kernel+0xba/0x110
> >     common_startup_64+0x12c/0x138
> 
> I doubt that's related to the networking pull request but I can see it
> caused by the above commit, now that we track per-cpu allocations. Most
> likely it's a false positive. I'll try to reproduce it next week but
> something like below might fix (untested):
> 
> diff --git a/mm/numa.c b/mm/numa.c
> index e2eec07707d1..c594d853cfe8 100644
> --- a/mm/numa.c
> +++ b/mm/numa.c
> @@ -1,5 +1,6 @@
>  // SPDX-License-Identifier: GPL-2.0-or-later
>  
> +#include <linux/kmemleak.h>
>  #include <linux/memblock.h>
>  #include <linux/printk.h>
>  #include <linux/numa.h>
> @@ -23,6 +24,9 @@ void __init alloc_node_data(int nid)
>  		      nd_size, nid);
>  	nd = __va(nd_pa);
>  
> +	/* needed to track related allocation stored in node_data[] */
> +	kmemleak_alloc(nd, nd_size, 0, 0);
> +
>  	/* report and initialize */
>  	pr_info("NODE_DATA(%d) allocated [mem %#010Lx-%#010Lx]\n", nid,
>  		nd_pa, nd_pa + nd_size - 1);

Hmm, I don't think this would make any difference as kmemleak does scan
the memblock allocations as long as they have a correspondent VA in the
linear map.

BTW, is NUMA enabled or disabled in your .config?

-- 
Catalin