* [PATCH] mm/kmemleak: Fix percpu memory leak detection failure
@ 2024-12-27 9:23 Guo Weikang
2024-12-27 10:37 ` Uros Bizjak
2024-12-31 12:04 ` Catalin Marinas
0 siblings, 2 replies; 5+ messages in thread
From: Guo Weikang @ 2024-12-27 9:23 UTC (permalink / raw)
To: Catalin Marinas, Andrew Morton, Uros Bizjak
Cc: Guo Weikang, linux-mm, linux-kernel
kmemleak_alloc_percpu gives an incorrect min_count parameter, 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 <guoweikang.kernel@gmail.com>
---
mm/kmemleak.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/kmemleak.c b/mm/kmemleak.c
index 238ab733fbea..982bb5ef3233 100644
--- a/mm/kmemleak.c
+++ b/mm/kmemleak.c
@@ -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
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] mm/kmemleak: Fix percpu memory leak detection failure
2024-12-27 9:23 [PATCH] mm/kmemleak: Fix percpu memory leak detection failure Guo Weikang
@ 2024-12-27 10:37 ` Uros Bizjak
2024-12-27 10:42 ` Uros Bizjak
2024-12-31 12:04 ` Catalin Marinas
1 sibling, 1 reply; 5+ messages in thread
From: Uros Bizjak @ 2024-12-27 10:37 UTC (permalink / raw)
To: Guo Weikang; +Cc: Catalin Marinas, Andrew Morton, linux-mm, linux-kernel
On Fri, Dec 27, 2024 at 10:23 AM Guo Weikang
<guoweikang.kernel@gmail.com> wrote:
>
> kmemleak_alloc_percpu gives an incorrect min_count parameter, 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 <guoweikang.kernel@gmail.com>
I don't know how 1 turned to 0, the change was definitely unintended.
Acked-by: Uros Bizjak <ubizjak@gmail.com>
Thanks,
Uros.
> ---
> mm/kmemleak.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/kmemleak.c b/mm/kmemleak.c
> index 238ab733fbea..982bb5ef3233 100644
> --- a/mm/kmemleak.c
> +++ b/mm/kmemleak.c
> @@ -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
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] mm/kmemleak: Fix percpu memory leak detection failure
2024-12-27 10:37 ` Uros Bizjak
@ 2024-12-27 10:42 ` Uros Bizjak
2024-12-31 12:03 ` Catalin Marinas
0 siblings, 1 reply; 5+ messages in thread
From: Uros Bizjak @ 2024-12-27 10:42 UTC (permalink / raw)
To: Guo Weikang; +Cc: Catalin Marinas, Andrew Morton, linux-mm, linux-kernel
On Fri, Dec 27, 2024 at 11:37 AM Uros Bizjak <ubizjak@gmail.com> wrote:
>
> On Fri, Dec 27, 2024 at 10:23 AM Guo Weikang
> <guoweikang.kernel@gmail.com> wrote:
> >
> > kmemleak_alloc_percpu gives an incorrect min_count parameter, 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 <guoweikang.kernel@gmail.com>
>
> 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/20240818210235.33481-2-ubizjak@gmail.com/T/#u
Uros.
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] mm/kmemleak: Fix percpu memory leak detection failure
2024-12-27 10:42 ` Uros Bizjak
@ 2024-12-31 12:03 ` Catalin Marinas
0 siblings, 0 replies; 5+ messages in thread
From: Catalin Marinas @ 2024-12-31 12:03 UTC (permalink / raw)
To: Uros Bizjak; +Cc: Guo Weikang, Andrew Morton, linux-mm, linux-kernel
On Fri, Dec 27, 2024 at 11:42:49AM +0100, Uros Bizjak wrote:
> On Fri, Dec 27, 2024 at 11:37 AM Uros Bizjak <ubizjak@gmail.com> wrote:
> > On Fri, Dec 27, 2024 at 10:23 AM Guo Weikang
> > <guoweikang.kernel@gmail.com> wrote:
> > > kmemleak_alloc_percpu gives an incorrect min_count parameter, 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 <guoweikang.kernel@gmail.com>
> >
> > 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/20240818210235.33481-2-ubizjak@gmail.com/T/#u
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.
--
Catalin
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mm/kmemleak: Fix percpu memory leak detection failure
2024-12-27 9:23 [PATCH] mm/kmemleak: Fix percpu memory leak detection failure Guo Weikang
2024-12-27 10:37 ` Uros Bizjak
@ 2024-12-31 12:04 ` Catalin Marinas
1 sibling, 0 replies; 5+ messages in thread
From: Catalin Marinas @ 2024-12-31 12:04 UTC (permalink / raw)
To: Guo Weikang; +Cc: Andrew Morton, Uros Bizjak, linux-mm, linux-kernel
On Fri, Dec 27, 2024 at 05:23:10PM +0800, Guo Weikang wrote:
> kmemleak_alloc_percpu gives an incorrect min_count parameter, 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 <guoweikang.kernel@gmail.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-12-31 12:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-27 9:23 [PATCH] mm/kmemleak: Fix percpu memory leak detection failure Guo Weikang
2024-12-27 10:37 ` Uros Bizjak
2024-12-27 10:42 ` Uros Bizjak
2024-12-31 12:03 ` Catalin Marinas
2024-12-31 12:04 ` Catalin Marinas
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox