aboutsummaryrefslogtreecommitdiffstats
path: root/mm/vmalloc.c
diff options
context:
space:
mode:
authorUladzislau Rezki (Sony) <[email protected]>2024-02-02 19:06:28 +0000
committerAndrew Morton <[email protected]>2024-02-24 01:48:20 +0000
commit96aa8437d169b8e030a98e2b74fd9a8ee9d3be7e (patch)
tree560f9cbbf606cab4b4f28f1523abdb4782afd649 /mm/vmalloc.c
parentmm: vmalloc: offload free_vmap_area_lock lock (diff)
downloadkernel-96aa8437d169b8e030a98e2b74fd9a8ee9d3be7e.tar.gz
kernel-96aa8437d169b8e030a98e2b74fd9a8ee9d3be7e.zip
mm: vmalloc: add a scan area of VA only once
Invoke a kmemleak_scan_area() function only for newly allocated objects to add a scan area within that object. There is no reason to add a same scan area(pointer to beginning or inside the object) several times. If a VA is obtained from the cache its scan area has already been associated. Link: https://lkml.kernel.org/r/[email protected] Fixes: 7db166b4aa0d ("mm: vmalloc: offload free_vmap_area_lock lock") Signed-off-by: Uladzislau Rezki (Sony) <[email protected]> Reviewed-by: Lorenzo Stoakes <[email protected]> Cc: Baoquan He <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Dave Chinner <[email protected]> Cc: Joel Fernandes (Google) <[email protected]> Cc: Kazuhito Hagio <[email protected]> Cc: Liam R. Howlett <[email protected]> Cc: Matthew Wilcox (Oracle) <[email protected]> Cc: Oleksiy Avramchenko <[email protected]> Cc: Paul E. McKenney <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'mm/vmalloc.c')
-rw-r--r--mm/vmalloc.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index e8b9621ea02b..75e96cf377ef 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -1834,13 +1834,13 @@ static struct vmap_area *alloc_vmap_area(unsigned long size,
va = kmem_cache_alloc_node(vmap_area_cachep, gfp_mask, node);
if (unlikely(!va))
return ERR_PTR(-ENOMEM);
- }
- /*
- * Only scan the relevant parts containing pointers to other objects
- * to avoid false negatives.
- */
- kmemleak_scan_area(&va->rb_node, SIZE_MAX, gfp_mask);
+ /*
+ * Only scan the relevant parts containing pointers to other objects
+ * to avoid false negatives.
+ */
+ kmemleak_scan_area(&va->rb_node, SIZE_MAX, gfp_mask);
+ }
retry:
if (addr == vend) {