[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230123170419.7292-6-george@enfabrica.net>
Date: Mon, 23 Jan 2023 11:04:15 -0600
From: George Prekas <george@...abrica.net>
To: linux-kernel@...r.kernel.org, linux-mm@...ck.org
Cc: Catalin Marinas <catalin.marinas@....com>,
Andrew Morton <akpm@...ux-foundation.org>,
Christoph Lameter <cl@...ux.com>,
Pekka Enberg <penberg@...nel.org>,
David Rientjes <rientjes@...gle.com>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
Vlastimil Babka <vbabka@...e.cz>,
Roman Gushchin <roman.gushchin@...ux.dev>,
Hyeonggon Yoo <42.hyeyoo@...il.com>,
Thomas Gleixner <tglx@...utronix.de>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Andy Lutomirski <luto@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
"Liam R. Howlett" <Liam.Howlett@...cle.com>,
Fenghua Yu <fenghua.yu@...el.com>,
Andrei Vagin <avagin@...il.com>,
George Prekas <george@...abrica.net>
Subject: [PATCH 5/9] mm: kmemleak: do not scan sparsemap_buf
sparsemap_buf is used for vmemmap and vmemmap contains an array of
struct page. kmemleak scans the pages separately. If it scans them
twice, then it will duplicate the number of found references and will
cause missed leaks.
Signed-off-by: George Prekas <george@...abrica.net>
---
mm/sparse.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/mm/sparse.c b/mm/sparse.c
index 2779b419ef2a..49df7a052037 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -14,6 +14,7 @@
#include <linux/swap.h>
#include <linux/swapops.h>
#include <linux/bootmem_info.h>
+#include <linux/kmemleak.h>
#include "internal.h"
#include <asm/dma.h>
@@ -466,6 +467,8 @@ static void __init sparse_buffer_init(unsigned long size, int nid)
*/
sparsemap_buf = memmap_alloc(size, section_map_size(), addr, nid, true);
sparsemap_buf_end = sparsemap_buf + size;
+ /* sparsemap_buf has been registered with its physical address in kmemleak */
+ kmemleak_no_scan_phys(virt_to_phys(sparsemap_buf));
}
static void __init sparse_buffer_fini(void)
--
2.37.1
Powered by blists - more mailing lists