mm/kmemleak: Fix percpu memory leak detection failure
Subsystems (2)
PATCH 1/1 mm/kmemleak: Fix percpu memory leak detection failure
kmemleak_alloc_percpu gives an incorrect min_count parameter, causing percpu memory to be considered a gray object.
--- mm/kmemleak.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/kmemleak.c +1 -1
@@ -1093,7 +1093,7 @@ void __ref kmemleak_alloc_percpu(const void __percpu *ptr, size_t size,pr_debug ("%s(0x%px, %zu)\n" , __func__, ptr, size);if (kmemleak_enabled && ptr && !IS_ERR_PCPU (ptr)) -create_object_percpu ((__force unsigned long )ptr, size,0 , gfp); +create_object_percpu ((__force unsigned long )ptr, size,1 , gfp); }EXPORT_SYMBOL_GPL (kmemleak_alloc_percpu);
Signature · 1 line
2.25.1
Quoted 7 lines · Guo Weikang
kmemleak_alloc_percpugives an incorrectmin_countparameter, causing percpu memory to be considered a gray object.Fixes 8c8685928910 ("mm/kmemleak: use IS_ERR_PCPU() for pointer in the percpu address space")Signed-off-by Guo Weikang <[email protected]>
I don't know how 1 turned to 0, the change was definitely unintended.
Thanks,
Uros.
Quoted 20 lines
--- mm/kmemleak.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/kmemleak.c +1
-2@@ -1093,7 +1093,7 @@ void __ref kmemleak_alloc_percpu(const void __percpu *ptr, size_t size,pr_debug ("%s(0x%px, %zu)\n" , __func__, ptr, size);if (kmemleak_enabled && ptr && !IS_ERR_PCPU (ptr)) -create_object_percpu ((__force unsigned long )ptr, size,0 , gfp); +create_object_percpu ((__force unsigned long )ptr, size,1 , gfp); }EXPORT_SYMBOL_GPL (kmemleak_alloc_percpu); --2.25.1
Quoted 4 lines · Uros Bizjak
Quoted 1 line · Guo Weikang
Quoted 8 lines
Quoted 6 lines
kmemleak_alloc_percpugives an incorrectmin_countparameter, causing percpu memory to be considered a gray object.Fixes 8c8685928910 ("mm/kmemleak: use IS_ERR_PCPU() for pointer in the percpu address space")Signed-off-by Guo Weikang <[email protected]>I don't know how 1 turned to 0, the change was definitely unintended.
Looking at the original patch at [1], it looks like a mismerge to me.
[1] https://lore.kernel.org/all/[email protected]/T/#u
Uros.
Catalin Marinas
maintainerQuoted 8 lines · Uros Bizjak
Quoted 7 lines · Uros Bizjak
Quoted 5 lines · Guo Weikang
kmemleak_alloc_percpugives an incorrectmin_countparameter, causing percpu memory to be considered a gray object.Fixes 8c8685928910 ("mm/kmemleak: use IS_ERR_PCPU() for pointer in the percpu address space")
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Guo Weikang <[email protected]>I don't know how 1 turned to 0, the change was definitely unintended.
Looking at the original patch at [1], it looks like a mismerge to me.
About the same time we had commit 6c99d4eb7c5e ("kmemleak: enable tracking for percpu pointers") increasing min_count to 1 but in the merge this got lost.
Signature · 1 line
Catalin
Quoted 6 lines · Guo Weikang
kmemleak_alloc_percpugives an incorrectmin_countparameter, causing percpu memory to be considered a gray object.Fixes 8c8685928910 ("mm/kmemleak: use IS_ERR_PCPU() for pointer in the percpu address space")Signed-off-by Guo Weikang <[email protected]>