Skip to contentSkip to conversation

fix-the-wrong-comment-on-task_lock-nesting-with-tasklist_lock.patch removed from -mm tree

merged mm-nonmm-stable Andrew Morton 1 participant 1 message Sep 23, 2025

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: sched/task.h: fix the wrong comment on task_lock() nesting with tasklist_lock
has been removed from the -mm tree. Its filename was
fix-the-wrong-comment-on-task_lock-nesting-with-tasklist_lock.patch

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

------------------------------------------------------
From: Oleg Nesterov <[email protected]>
Subject: sched/task.h: fix the wrong comment on task_lock() nesting with tasklist_lock
Date: Sun, 14 Sep 2025 13:09:08 +0200

The ancient comment above task_lock() states that it can be nested outside of read_lock(&tasklist_lock), but this is no longer true:

CPU_0 CPU_1 CPU_2

task_lock() read_lock(tasklist)
write_lock_irq(tasklist)
read_lock(tasklist) task_lock()

Unless CPU_0 calls read_lock() in IRQ context, queued_read_lock_slowpath() won't get the lock immediately, it will spin waiting for the pending writer on CPU_2, resulting in a deadlock.

---

 include/linux/sched/task.h |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
include/linux/sched/task.h renamed from include/linux/sched/task.h~fix-the-wrong-comment-on-task_lock-nesting-with-tasklist_lock +2 -3
@@ -210,9 +210,8 @@ static inline struct vm_struct *task_sta
  * pins the final release of task.io_context.  Also protects ->cpuset and
  * ->cgroup.subsys[]. And ->vfork_done. And ->sysvshm.shm_clist.
  *
- * Nests both inside and outside of read_lock(&tasklist_lock).
- * It must not be nested with write_lock_irq(&tasklist_lock),
- * neither inside nor outside.
+ * Nests inside of read_lock(&tasklist_lock). It must not be nested with
+ * write_lock_irq(&tasklist_lock), neither inside nor outside.
  */
 static inline void task_lock(struct task_struct *p)
 {

_

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