lkml.org 
[lkml]   [2023]   [Oct]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] freezer,sched: Report TASK_FROZEN tasks as TASK_UNINTERRUPTIBLE
Date
TASK_FROZEN is not in TASK_REPORT, thus a frozen task will appear as
state == 0, IOW TASK_RUNNING.

Fix this by make TASK_FROZEN appear as TASK_UNINTERRUPTIBLE, thus we
dont need to imply a new state to userspace tools.

Signed-off-by: Liangliang Li <liliangliang@vivo.com>
---
include/linux/sched.h | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/include/linux/sched.h b/include/linux/sched.h
index 292c31697248..0cfe2ba4fc6f 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1690,6 +1690,10 @@ static inline unsigned int __task_state_index(unsigned int tsk_state,
if (tsk_state & TASK_RTLOCK_WAIT)
state = TASK_UNINTERRUPTIBLE;

+ /* Frozen tasks should appear as "D (disk sleep)' in userspace. */
+ if (tsk_state & TASK_FROZEN)
+ state = TASK_UNINTERRUPTIBLE;
+
return fls(state);
}

--
2.34.1
\
 
 \ /
  Last update: 2023-10-23 15:59    [W:0.040 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site