[Crash-utility] [PATCH] runq: search current task's runqueue explicitly

HATAYAMA Daisuke d.hatayama at jp.fujitsu.com
Thu Jan 5 10:24:21 UTC 2012


Currently, runq sub-command doesn't consider CFS runqueue's current
task removed from CFS runqueue. Due to this, the remaining CFS
runqueus that follow the current task's is not displayed. This patch
fixes this by making runq sub-command search current task's runqueue
explicitly.

Note that CFS runqueue exists for each task group, and so does CFS
runqueue's current task, and the above search needs to be done
recursively.

Test
====

On vmcore I made 7 task groups:

  root group --- A --- AA --- AAA
                    +      +- AAB
                    |
                    +- AB --- ABA
                           +- ABB

and then I ran three CPU bound tasks, which is exactly the same as

  int main(void) { for (;;) continue; return 0; }

for each task group, including root group; so total 24 tasks. For
readability, I annotated each task name with its belonging group name.
For example, loop.ABA belongs to task group ABA.

Look at CPU0 collumn below. [before] lacks 8 tasks and [after]
successfully shows all tasks on the runqueue, which is identical to
the result of [sched debug] that is expected to ouput correct result.

I'll send this vmcore later.

[before]

crash> runq | cat
CPU 0 RUNQUEUE: ffff88000a215f80
  CURRENT: PID: 28263  TASK: ffff880037aaa040  COMMAND: "loop.ABA"
  RT PRIO_ARRAY: ffff88000a216098
     [no tasks queued]
  CFS RB_ROOT: ffff88000a216010
     [120] PID: 28262  TASK: ffff880037cc40c0  COMMAND: "loop.ABA"

<cut>

[after]

crash_fix> runq
CPU 0 RUNQUEUE: ffff88000a215f80
  CURRENT: PID: 28263  TASK: ffff880037aaa040  COMMAND: "loop.ABA"
  RT PRIO_ARRAY: ffff88000a216098
     [no tasks queued]
  CFS RB_ROOT: ffff88000a216010
     [120] PID: 28262  TASK: ffff880037cc40c0  COMMAND: "loop.ABA"
     [120] PID: 28271  TASK: ffff8800787a8b40  COMMAND: "loop.ABB"
     [120] PID: 28272  TASK: ffff880037afd580  COMMAND: "loop.ABB"
     [120] PID: 28245  TASK: ffff8800785e8b00  COMMAND: "loop.AB"
     [120] PID: 28246  TASK: ffff880078628ac0  COMMAND: "loop.AB"
     [120] PID: 28241  TASK: ffff880078616b40  COMMAND: "loop.AA"
     [120] PID: 28239  TASK: ffff8800785774c0  COMMAND: "loop.AA"
     [120] PID: 28240  TASK: ffff880078617580  COMMAND: "loop.AA"
     [120] PID: 28232  TASK: ffff880079b5d4c0  COMMAND: "loop.A"
<cut>

[sched debug]

crash> runq -d
CPU 0
     [120] PID: 28232  TASK: ffff880079b5d4c0  COMMAND: "loop.A"
     [120] PID: 28239  TASK: ffff8800785774c0  COMMAND: "loop.AA"
     [120] PID: 28240  TASK: ffff880078617580  COMMAND: "loop.AA"
     [120] PID: 28241  TASK: ffff880078616b40  COMMAND: "loop.AA"
     [120] PID: 28245  TASK: ffff8800785e8b00  COMMAND: "loop.AB"
     [120] PID: 28246  TASK: ffff880078628ac0  COMMAND: "loop.AB"
     [120] PID: 28262  TASK: ffff880037cc40c0  COMMAND: "loop.ABA"
     [120] PID: 28263  TASK: ffff880037aaa040  COMMAND: "loop.ABA"
     [120] PID: 28271  TASK: ffff8800787a8b40  COMMAND: "loop.ABB"
     [120] PID: 28272  TASK: ffff880037afd580  COMMAND: "loop.ABB"
<cut>

Diff stat
=========

 defs.h |    1 +
 task.c |   37 +++++++++++++++++--------------------
 2 files changed, 18 insertions(+), 20 deletions(-)

Thanks.
HATAYAMA, Daisuke
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-runq-search-current-task-s-runqueue-explicitly.patch
Type: application/octet-stream
Size: 4581 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/crash-utility/attachments/20120105/8845f707/attachment.obj>


More information about the Crash-utility mailing list