[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20240617065755.9996-1-xuewen.yan@unisoc.com>
Date: Mon, 17 Jun 2024 14:57:55 +0800
From: Xuewen Yan <xuewen.yan@...soc.com>
To: <peterz@...radead.org>, <mingo@...hat.com>, <rafael@...nel.org>,
<pavel@....cz>
CC: <ke.wang@...soc.com>, <guohua.yan@...soc.com>, <xuewen.yan94@...il.com>,
<di.shen@...soc.com>, <linux-pm@...r.kernel.org>,
<linux-kernel@...r.kernel.org>
Subject: [RFC PATCH] 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.
Co-developed-by: Guohua Yan <guohua.yan@...soc.com>
Signed-off-by: Guohua Yan <guohua.yan@...soc.com>
Signed-off-by: Xuewen Yan <xuewen.yan@...soc.com>
---
kernel/freezer.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/freezer.c b/kernel/freezer.c
index f57aaf96b829..cc50721616a2 100644
--- a/kernel/freezer.c
+++ b/kernel/freezer.c
@@ -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;
--
2.25.1
Powered by blists - more mailing lists