Skip to contentSkip to conversation

mm-kmemleak-use-pf_kthread-flag-to-detect-kernel-threads.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Mar 24

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/kmemleak: use PF_KTHREAD flag to detect kernel threads
has been removed from the -mm tree. Its filename was
mm-kmemleak-use-pf_kthread-flag-to-detect-kernel-threads.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Zhongqiu Han <[email protected]>
Subject: mm/kmemleak: use PF_KTHREAD flag to detect kernel threads
Date: Fri, 30 Jan 2026 17:37:29 +0800

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.

---

 mm/kmemleak.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
mm/kmemleak.c renamed from mm/kmemleak.c~mm-kmemleak-use-pf_kthread-flag-to-detect-kernel-threads +3 -3
@@ -1505,10 +1505,10 @@ static int scan_should_stop(void)
 	 * This function may be called from either process or kthread context,
 	 * hence the need to check for both stop conditions.
 	 */
-	if (current->mm)
-		return signal_pending(current);
+	if (current->flags & PF_KTHREAD)
+		return kthread_should_stop();
 
-	return kthread_should_stop();
+	return signal_pending(current);
 }
 
 /*

_

Patches currently in -mm which might be from [email protected] are