diff -urN crash-7.0.3/help.c crash-7.0.3.new/help.c --- crash-7.0.3/help.c 2013-10-25 15:27:34.000000000 -0400 +++ crash-7.0.3.new/help.c 2013-11-08 10:32:26.000000000 -0500 @@ -2361,7 +2361,8 @@ " whichever applies; following each cpu timestamp is the last_run or ", " timestamp value of the active task on that cpu, whichever applies, ", " along with the task identification.", -" -g Display tasks hierarchically by task_group. Tasks in throttled groups", +" -g Display tasks hierarchically by task_group. The task_group line shows", +" the value of task_group, cfs_rq, rb_root. Tasks in throttled groups", " are also displayed.", "\nEXAMPLES", " Display the tasks on an O(1) scheduler run queue:\n", @@ -2430,11 +2431,11 @@ " CFS RB_ROOT: ffff880028216718", " [120] PID: 14740 TASK: ffff88013b1e6080 COMMAND: \"sh\"", " [120] PID: 14738 TASK: ffff88012678d540 COMMAND: \"sh\"", -" GROUP CFS RB_ROOT: ffff8800897af430 (THROTTLED)", +" GROUP: ffff884052bc9800 CFS_RQ: ffff8831e4a1b000 RB_ROOT: ffff8800897af430 (THROTTLED)", " [120] PID: 14732 TASK: ffff88013bbcb500 COMMAND: \"sh\"", " [120] PID: 14728 TASK: ffff8800b3496080 COMMAND: \"sh\"", " [120] PID: 14730 TASK: ffff880037833540 COMMAND: \"sh\"", -" GROUP CFS RB_ROOT: ffff880037943e30 (THROTTLED)", +" GROUP: ffff884058f1d000 CFS_RQ: ffff88120a101600 RB_ROOT: ffff880037943e30 (THROTTLED)", " [120] PID: 14726 TASK: ffff880138d42aa0 COMMAND: \"sh\"", " ", " CPU 1", @@ -2448,7 +2449,7 @@ " [ 98] PID: 14747 TASK: ffff88013b1e6ae0 COMMAND: \"rtloop1\"", " TASK_GROUP CFS_RQ: ffff8800282966e8", " CFS RB_ROOT: ffff880028296718", -" GROUP CFS RB_ROOT: ffff8800896eac30 ", +" GROUP: ffff884058f1d000 CFS_RQ: ffff883e5d9f3200 RB_ROOT: ffff8800896eac30 ", " [120] PID: 14724 TASK: ffff880139632080 COMMAND: \"sh\"", " [120] PID: 14742 TASK: ffff880126762aa0 COMMAND: \"sh\"", " [120] PID: 14736 TASK: ffff88010626e040 COMMAND: \"sh\"", diff -urN crash-7.0.3/task.c crash-7.0.3.new/task.c --- crash-7.0.3/task.c 2013-10-25 15:27:34.000000000 -0400 +++ crash-7.0.3.new/task.c 2013-11-08 10:33:15.000000000 -0500 @@ -56,12 +56,12 @@ static void dump_on_rq_timestamp(void); static void dump_runqueues(void); static void dump_prio_array(int, ulong, char *); -static void dump_task_runq_entry(struct task_context *); +static void dump_task_runq_entry(struct task_context *, int); static void print_group_header_fair(int, ulong, void *); static void print_parent_task_group_fair(void *, int); -static int dump_tasks_in_lower_dequeued_cfs_rq(int, ulong, int); +static int dump_tasks_in_lower_dequeued_cfs_rq(int, ulong, int, struct task_context *, ulong); static int dump_tasks_in_cfs_rq(ulong); -static int dump_tasks_in_task_group_cfs_rq(int, ulong, int); +static int dump_tasks_in_task_group_cfs_rq(int, ulong, int, struct task_context *, ulong); static void dump_on_rq_tasks(void); static void cfs_rq_offset_init(void); static void task_group_offset_init(void); @@ -7600,15 +7600,19 @@ } static void -dump_task_runq_entry(struct task_context *tc) +dump_task_runq_entry(struct task_context *tc, int current) { int prio; readmem(tc->task + OFFSET(task_struct_prio), KVADDR, &prio, sizeof(int), "task prio", FAULT_ON_ERROR); fprintf(fp, "[%3d] ", prio); - fprintf(fp, "PID: %-5ld TASK: %lx COMMAND: \"%s\"\n", + fprintf(fp, "PID: %-5ld TASK: %lx COMMAND: \"%s\"", tc->pid, tc->task, tc->comm); + if (current) + fprintf(fp, " [CURRENT]\n"); + else + fprintf(fp, "\n"); } static void @@ -7620,7 +7624,8 @@ root = (struct rb_root *)(cfs_rq + OFFSET(cfs_rq_tasks_timeline)); INDENT(2 + 3 * depth); - fprintf(fp, "GROUP CFS RB_ROOT: %lx", (ulong)root); + fprintf(fp, "GROUP: %lx CFS_RQ: %lx RB_ROOT: %lx", + tgi->task_group, cfs_rq, (ulong)root); if (tgi->name) fprintf(fp, " <%s>", tgi->name); @@ -7657,7 +7662,8 @@ } static int -dump_tasks_in_lower_dequeued_cfs_rq(int depth, ulong cfs_rq, int cpu) +dump_tasks_in_lower_dequeued_cfs_rq(int depth, ulong cfs_rq, int cpu, + struct task_context *ctc, ulong task_cfs_rq) { int i, total, nr_running; ulong group, cfs_rq_c, cfs_rq_p; @@ -7685,14 +7691,14 @@ FAULT_ON_ERROR); if (nr_running == 0) { total += dump_tasks_in_lower_dequeued_cfs_rq(depth + 1, - cfs_rq_p, cpu); + cfs_rq_p, cpu, ctc, task_cfs_rq); continue; } print_parent_task_group_fair(tgi_array[i], cpu); total++; - total += dump_tasks_in_task_group_cfs_rq(depth + 1, cfs_rq_p, cpu); + total += dump_tasks_in_task_group_cfs_rq(depth + 1, cfs_rq_p, cpu, ctc, task_cfs_rq); } return total; @@ -7742,7 +7748,7 @@ continue; if (hq_enter((ulong)tc)) { INDENT(5); - dump_task_runq_entry(tc); + dump_task_runq_entry(tc, 0); } else { error(WARNING, "duplicate CFS runqueue node: task %lx\n", tc->task); @@ -7755,7 +7761,8 @@ } static int -dump_tasks_in_task_group_cfs_rq(int depth, ulong cfs_rq, int cpu) +dump_tasks_in_task_group_cfs_rq(int depth, ulong cfs_rq, int cpu, + struct task_context *ctc, ulong task_cfs_rq) { struct task_context *tc; struct rb_root *root; @@ -7789,11 +7796,21 @@ if (curr_my_q) { total++; total += dump_tasks_in_task_group_cfs_rq(depth + 1, - curr_my_q, cpu); + curr_my_q, cpu, ctc, task_cfs_rq); } } } + /* + * check if "curr" is the task that is current running task + */ + if (!curr_my_q && (curr - OFFSET(task_struct_se)) == ctc->task) { + /* curr is not in the rb tree, so let's print it here */ + total++; + INDENT(5 + 3 * depth); + dump_task_runq_entry(ctc, 1); + } + readmem(cfs_rq + OFFSET(cfs_rq_rb_leftmost), KVADDR, &leftmost, sizeof(ulong), "rb_leftmost", FAULT_ON_ERROR); root = (struct rb_root *)(cfs_rq + OFFSET(cfs_rq_tasks_timeline)); @@ -7806,7 +7823,7 @@ if (my_q) { total++; total += dump_tasks_in_task_group_cfs_rq(depth + 1, - my_q, cpu); + my_q, cpu, ctc, task_cfs_rq); continue; } } @@ -7817,7 +7834,7 @@ continue; if (hq_enter((ulong)tc)) { INDENT(5 + 3 * depth); - dump_task_runq_entry(tc); + dump_task_runq_entry(tc, 0); } else { error(WARNING, "duplicate CFS runqueue node: task %lx\n", tc->task); @@ -7826,7 +7843,7 @@ total++; } - total += dump_tasks_in_lower_dequeued_cfs_rq(depth, cfs_rq, cpu); + total += dump_tasks_in_lower_dequeued_cfs_rq(depth, cfs_rq, cpu, ctc, task_cfs_rq); if (!total) { INDENT(5 + 3 * depth); @@ -7879,7 +7896,7 @@ continue; INDENT(5); - dump_task_runq_entry(tc); + dump_task_runq_entry(tc, 0); tot++; } @@ -7991,7 +8008,7 @@ fprintf(fp, " CURRENT: "); if ((tc = task_to_context(tt->active_set[cpu]))) - fprintf(fp, "PID: %-5ld TASK: %lx COMMAND: \"%s\"\n", + fprintf(fp, "PID: %-5ld TASK: %lx COMMAND: \"%s\"\n", tc->pid, tc->task, tc->comm); else fprintf(fp, "%lx\n", tt->active_set[cpu]); @@ -8413,7 +8430,7 @@ dump_tasks_by_task_group(void) { int cpu; - ulong root_task_group, cfs_rq, cfs_rq_p; + ulong root_task_group, cfs_rq, cfs_rq_p, task_cfs_rq; ulong rt_rq, rt_rq_p; char *buf; struct rb_root *root; @@ -8453,10 +8470,14 @@ sizeof(ulong), "task_group cfs_rq", FAULT_ON_ERROR); fprintf(fp, "%sCPU %d\n", cpu ? "\n" : "", cpu); fprintf(fp, " CURRENT: "); - if ((tc = task_to_context(tt->active_set[cpu]))) - fprintf(fp, "PID: %-5ld TASK: %lx COMMAND: \"%s\"\n", - tc->pid, tc->task, tc->comm); - else + if ((tc = task_to_context(tt->active_set[cpu]))) { + readmem(tc->task + OFFSET(task_struct_se) + + OFFSET(sched_entity_cfs_rq), KVADDR, + &task_cfs_rq, sizeof(ulong), "seched_entity cfs_rq", + FAULT_ON_ERROR); + fprintf(fp, "PID: %-5ld CFS: %lx TASK: %lx COMMAND: \"%s\"\n", + tc->pid, task_cfs_rq, tc->task, tc->comm); + } else fprintf(fp, "%lx\n", tt->active_set[cpu]); fprintf(fp, " TASK_GROUP RT_RQ: %lx\n", rt_rq_p); @@ -8469,7 +8490,7 @@ fprintf(fp, " TASK_GROUP CFS_RQ: %lx\n", cfs_rq_p); fprintf(fp, " CFS RB_ROOT: %lx\n", (ulong)root); reuse_task_group_info_array(); - dump_tasks_in_task_group_cfs_rq(0, cfs_rq_p, cpu); + dump_tasks_in_task_group_cfs_rq(0, cfs_rq_p, cpu, tc, task_cfs_rq); } FREEBUF(buf);