]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
mm/kmemleak: use PF_KTHREAD flag to detect kernel threads
authorZhongqiu Han <zhongqiu.han@oss.qualcomm.com>
Fri, 30 Jan 2026 09:37:29 +0000 (17:37 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 5 Apr 2026 20:53:02 +0000 (13:53 -0700)
commitc2d9196541fa58de16e219092f56ae507c925cac
tree7a7896f737013006383fba45b100825e7fb1c3cd
parentfc9ef2978d440162f507f70cbc351006af9a77d4
mm/kmemleak: use PF_KTHREAD flag to detect kernel threads

Replace the current->mm check with PF_KTHREAD flag for more reliable
kernel thread detection in scan_should_stop().  The PF_KTHREAD flag is the
standard way to identify kernel threads and is not affected by temporary
mm borrowing via kthread_use_mm() (although kmemleak does not currently
encounter such cases, this makes the code more robust).

No functional change.

Link: https://lkml.kernel.org/r/20260130093729.2045858-3-zhongqiu.han@oss.qualcomm.com
Signed-off-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com>
Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/kmemleak.c