[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241213110332.3105932-1-chenridong@huaweicloud.com>
Date: Fri, 13 Dec 2024 11:03:32 +0000
From: Chen Ridong <chenridong@...weicloud.com>
To: mingo@...hat.com,
peterz@...radead.org,
juri.lelli@...hat.com,
vincent.guittot@...aro.org,
dietmar.eggemann@....com,
rostedt@...dmis.org,
bsegall@...gle.com,
mgorman@...e.de,
vschneid@...hat.com,
tj@...nel.org,
mkoutny@...e.com,
roman.gushchin@...ux.dev
Cc: linux-kernel@...r.kernel.org,
cgroups@...r.kernel.org,
chenridong@...wei.com,
wangweiyang2@...wei.com
Subject: [PATCH v2] freezer, sched: report the frozen task stat as 'D'
From: Chen Ridong <chenridong@...wei.com>
Before the commit f5d39b020809 ("freezer,sched: Rewrite core freezer
logic"), the frozen task stat was reported as 'D' in cgroup v1.
However, after rewriting core freezer logic, the frozen task stat is
reported as 'R'. This is confusing, especially when a task with stat of
'S' is frozen.
This can be reproduced as bellow step:
cd /sys/fs/cgroup/freezer/
mkdir test
sleep 1000 &
[1] 739 // task whose stat is 'S'
echo 739 > test/cgroup.procs
echo FROZEN > test/freezer.state
ps -aux | grep 739
root 739 0.1 0.0 8376 1812 pts/0 R 10:56 0:00 sleep 1000
As shown above, a task whose stat is 'S' was changed to 'R' when it was
frozen. To solve this issue, simply maintain the same reported state as
before the rewrite.
Fixes: f5d39b020809 ("freezer,sched: Rewrite core freezer logic")
Signed-off-by: Chen Ridong <chenridong@...wei.com>
---
include/linux/sched.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/linux/sched.h b/include/linux/sched.h
index d380bffee2ef..dbe0cb97461f 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1630,8 +1630,9 @@ static inline unsigned int __task_state_index(unsigned int tsk_state,
* We're lying here, but rather than expose a completely new task state
* to userspace, we can make this appear as if the task has gone through
* a regular rt_mutex_lock() call.
+ * Report the frozen task uninterruptible.
*/
- if (tsk_state & TASK_RTLOCK_WAIT)
+ if (tsk_state & TASK_RTLOCK_WAIT || tsk_state & TASK_FROZEN)
state = TASK_UNINTERRUPTIBLE;
return fls(state);
--
2.34.1
Powered by blists - more mailing lists