Skip to contentSkip to conversation

get_task_mm-check-pf_kthread-lockless.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Jul 5, 2024

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: get_task_mm: check PF_KTHREAD lockless
has been removed from the -mm tree. Its filename was
get_task_mm-check-pf_kthread-lockless.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: Oleg Nesterov <[email protected]>
Subject: get_task_mm: check PF_KTHREAD lockless
Date: Wed, 26 Jun 2024 21:10:17 +0200

Nowadays PF_KTHREAD is sticky and it was never protected by ->alloc_lock. Move the PF_KTHREAD check outside of task_lock() section to make this code more understandable.

---

 kernel/fork.c |   11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
kernel/fork.c renamed from kernel/fork.c~get_task_mm-check-pf_kthread-lockless +5 -6
@@ -1536,14 +1536,13 @@ struct mm_struct *get_task_mm(struct tas
 {
 	struct mm_struct *mm;
 
+	if (task->flags & PF_KTHREAD)
+		return NULL;
+
 	task_lock(task);
 	mm = task->mm;
-	if (mm) {
-		if (task->flags & PF_KTHREAD)
-			mm = NULL;
-		else
-			mmget(mm);
-	}
+	if (mm)
+		mmget(mm);
 	task_unlock(task);
 	return mm;
 }

_

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

zap_pid_ns_processes-dont-send-sigkill-to-sub-threads.patch coredump-simplify-zap_process.patch