mm: vmalloc: Add a scan area of VA only once
Subsystems (2)
Uladzislau Rezki (Sony)
maintainerPATCH 1/1 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.
--- mm/vmalloc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
mm/vmalloc.c +6 -6
@@ -1882,13 +1882,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) {
Signature · 1 line
2.39.2
Quoted 37 lines · Uladzislau Rezki (Sony)
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.Fixes 7db166b4aa0d ("mm: vmalloc: offload free_vmap_area_lock lock")Signed-off-by Uladzislau Rezki (Sony) <[email protected]>--- mm/vmalloc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)mm/vmalloc.c +6
-7@@ -1882,13 +1882,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) { --
Quoted 2 lines
2.39.2
Looks good to me, feel free to add:
Uladzislau Rezki
maintainerQuoted 43 lines · Lorenzo Stoakes
Quoted 37 lines · Uladzislau Rezki (Sony)
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.Fixes 7db166b4aa0d ("mm: vmalloc: offload free_vmap_area_lock lock")Signed-off-by Uladzislau Rezki (Sony) <[email protected]>--- mm/vmalloc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)mm/vmalloc.c +6
-7@@ -1882,13 +1882,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) { --Quoted 2 lines
2.39.2
Looks good to me, feel free to add:
Quoted 2 lines
Reviewed-by Lorenzo Stoakes <[email protected]>
Appreciate for review!
--
Uladzislau Rezki
mm/vmalloc.c static struct vmap_area *alloc_vmap_area(unsigned long size, · line 1887
Quoted 1 line
mm/vmalloc.c +1
-0+* Only scan the relevant parts containing pointers to other objects
Please avoid the overly long line.
The rest looks fine.
Quoted 1 line
mm/vmalloc.c +1
-0+* to avoid false negatives.
Uladzislau Rezki
maintainerQuoted 8 lines · Christoph Hellwig
mm/vmalloc.c static struct vmap_area *alloc_vmap_area(unsigned long size, · line 1887
Quoted 1 line
mm/vmalloc.c +1
-0+* Only scan the relevant parts containing pointers to other objects Please avoid the overly long line.
The rest looks fine.
mm/vmalloc.c static struct vmap_area *alloc_vmap_area(unsigned long size, · line 1888
Quoted 1 line
mm/vmalloc.c +1
-0+* to avoid false negatives.
Thanks!
--
Uladzislau Rezki