Skip to contentSkip to conversation

freezer,sched: Preventing kthreads with D-state from being woken up during freeze

RFC PATCH New Xuewen Yan 1 participant 1 message Jun 17, 2024 Freezer

lore
Share & tools
lore

Xuewen Yan

author
#0 lore raw

RFC PATCH 1/1 freezer,sched: Preventing kthreads with D-state from being woken up during freeze

Sometimes althought a kthread was set to be freezable, the thread's state also could be TASK_UNINTERRUPTIBLE because of some blocked reasons, such as msleep, wait_for_complete, mutex and so on... And now, when freezing, the freezer would wakeup them even if their conditions have not been met, this may not be necessary, and sometimes waking up early for schedule_timeout() may cause some driver functions to fail.
So only wake_up kthreads with TASK_INTERRUPTIBLE state.

---
 kernel/freezer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/freezer.c +1 -1
index f57aaf96b829..cc50721616a2 100644
@@ -168,7 +168,7 @@ bool freeze_task(struct task_struct *p)
 	if (!(p->flags & PF_KTHREAD))
 		fake_signal_wake_up(p);
 	else
-		wake_up_state(p, TASK_NORMAL);
+		wake_up_state(p, TASK_INTERRUPTIBLE);
 
 	spin_unlock_irqrestore(&freezer_lock, flags);
 	return true;
Signature · 1 line
2.25.1