lkml.org 
[lkml]   [2023]   [Jan]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 5/9] mm: kmemleak: do not scan sparsemap_buf
Date
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@enfabrica.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
\
 
 \ /
  Last update: 2023-03-26 23:52    [W:0.100 / U:0.832 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site