Since Linux 4.14, kernel commit 20435d84e5 ("sched/debug: Intruduce
task_state_to_char() helper function") removed the 'stat_nam' symbol,
with which we've got the values of task state bitmasks.  So now we
need to get them correctly by using 'task_state_array' again.

Signed-off-by: Kazuhito Hagio <k-ha...@ab.jp.nec.com>
---
 task.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/task.c b/task.c
index 1b32629..164e546 100644
--- a/task.c
+++ b/task.c
@@ -5282,6 +5282,7 @@ old_defaults:
        /*
         *  If the later version of stat_nam[] array exists that contains 
         *  WAKING, WAKEKILL and PARKED, use it instead of task_state_array[].
+        *  Available since kernel version 2.6.33 to 4.13.
         */
        if (((len = get_array_length("stat_nam", NULL, 0)) > 0) &&
            read_string(symbol_value("stat_nam"), buf, BUFSIZE-1) &&
@@ -5393,7 +5394,15 @@ old_defaults:
                _NONINTERACTIVE_ = 64;
        }
 
-       if (THIS_KERNEL_VERSION >= LINUX(2,6,32)) {
+       if (THIS_KERNEL_VERSION >= LINUX(4,14,0)) {
+               if (valid_task_state(_PARKED_)) {
+                       bitpos = _PARKED_;
+                       _DEAD_ |= (bitpos << 1);    /* TASK_DEAD */
+                       _WAKEKILL_ = (bitpos << 2); /* TASK_WAKEKILL */
+                       _WAKING_ = (bitpos << 3);   /* TASK_WAKING */
+                       _NOLOAD_ = (bitpos << 4);   /* TASK_NOLOAD */
+               }
+       } else if (THIS_KERNEL_VERSION >= LINUX(2,6,32)) {
                /*
                 * Account for states not listed in task_state_array[]
                 */
-- 
1.8.3.1

--
Crash-utility mailing list
Crash-utility@redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility

Reply via email to