Skip to content

Commit 581d8a5

Browse files
Chen Ridonggregkh
authored andcommitted
freezer, sched: Report frozen tasks as 'D' instead of 'R'
[ Upstream commit f718faf3940e95d5d34af9041f279f598396ab7d ] Before commit: f5d39b0 ("freezer,sched: Rewrite core freezer logic") the frozen task stat was reported as 'D' in cgroup v1. However, after rewriting the 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 bug can be reproduced with these steps: $ 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 regression, simply maintain the same reported state as before the rewrite. [ mingo: Enhanced the changelog and comments ] Fixes: f5d39b0 ("freezer,sched: Rewrite core freezer logic") Signed-off-by: Chen Ridong <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Acked-by: Tejun Heo <[email protected]> Acked-by: Michal Koutný <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sasha Levin <[email protected]>
1 parent b0ce4e8 commit 581d8a5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

include/linux/sched.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1670,8 +1670,9 @@ static inline unsigned int __task_state_index(unsigned int tsk_state,
16701670
* We're lying here, but rather than expose a completely new task state
16711671
* to userspace, we can make this appear as if the task has gone through
16721672
* a regular rt_mutex_lock() call.
1673+
* Report frozen tasks as uninterruptible.
16731674
*/
1674-
if (tsk_state & TASK_RTLOCK_WAIT)
1675+
if ((tsk_state & TASK_RTLOCK_WAIT) || (tsk_state & TASK_FROZEN))
16751676
state = TASK_UNINTERRUPTIBLE;
16761677

16771678
return fls(state);

0 commit comments

Comments
 (0)