于 2012年11月14日 02:56, Dave Anderson 写道: > > > ----- Original Message ----- > >>> I was suggesting that you display per-cpu addresses generated from the >>> init_task_group/root_task_group task_group structures. Wouldn't it make >>> more sense for it to show both the per-cpu "rt_rq" and "cfs_rq" >>> addresses? >>> >>> In other words, maybe something like: >>> >>> CPU 0 TASK_GROUP RT_RQ: ffff88021e213e28 TASK_GROUP CFS_RQ: >>> ffff88021e213d30 >>> CURRENT: ... >>> >> >> OK, fixed. > > Hello Zhang, > > Thanks -- and this patch tests OK. > > For clarity, I changed the output slightly to show the per-cpu task_group rt_rq > and cfs_rq pointers above their respective queues. (The rt_rq and rt prio_array > addresses are the same because of the structure layout, but that's not > necessarily always going to be true.) And I tried to make the help page > description a little cleaner. So here's what it looks like: > > crash> help runq > ... [ cut ] ... > > -g Display tasks hierarchically by task_group. Tasks in throttled groups > are also displayed. > > ... [cut] ... > > Display tasks hierarchically by task_group: > > crash> runq -g > CPU 0 > CURRENT: PID: 14734 TASK: ffff88010626f500 COMMAND: "sh" > TASK_GROUP RT_RQ: ffff880028216808 > RT PRIO_ARRAY: ffff880028216808 > [ 0] GROUP RT PRIO_ARRAY: ffff880139fc9800 <test1> (THROTTLED) > [ 0] PID: 14750 TASK: ffff88013a4dd540 COMMAND: "rtloop99" > [ 1] PID: 14748 TASK: ffff88013bbca040 COMMAND: "rtloop98" > [ 1] GROUP RT PRIO_ARRAY: ffff880089029000 <test11> > [ 1] PID: 14752 TASK: ffff880088abf500 COMMAND: "rtloop98" > [ 54] PID: 14749 TASK: ffff880037a4e080 COMMAND: "rtloop45" > [ 98] PID: 14746 TASK: ffff88012678c080 COMMAND: "rtloop1" > TASK_GROUP CFS_RQ: ffff8800282166e8 > CFS RB_ROOT: ffff880028216718 > [120] PID: 14740 TASK: ffff88013b1e6080 COMMAND: "sh" > [120] PID: 14738 TASK: ffff88012678d540 COMMAND: "sh" > GROUP CFS RB_ROOT: ffff8800897af430 <test2> (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 <test1> (THROTTLED) > [120] PID: 14726 TASK: ffff880138d42aa0 COMMAND: "sh" > > CPU 1 > CURRENT: PID: 3269 TASK: ffff88013b0fa040 COMMAND: "bash" > TASK_GROUP RT_RQ: ffff880028296808 > RT PRIO_ARRAY: ffff880028296808 > [ 0] GROUP RT PRIO_ARRAY: ffff88008a1f5000 <test1> (THROTTLED) > [ 0] GROUP RT PRIO_ARRAY: ffff880121774800 <test11> > [ 0] PID: 14753 TASK: ffff88013bbbaae0 COMMAND: "rtloop99" > [ 98] PID: 14745 TASK: ffff880126763500 COMMAND: "rtloop1" > [ 98] PID: 14747 TASK: ffff88013b1e6ae0 COMMAND: "rtloop1" > TASK_GROUP CFS_RQ: ffff8800282966e8 > CFS RB_ROOT: ffff880028296718 > GROUP CFS RB_ROOT: ffff8800896eac30 <test1> > [120] PID: 14724 TASK: ffff880139632080 COMMAND: "sh" > [120] PID: 14742 TASK: ffff880126762aa0 COMMAND: "sh" > [120] PID: 14736 TASK: ffff88010626e040 COMMAND: "sh" > > crash> This seems more clear. Thanks. > > Are you planning any further changes, or would you like to go with this > version for crash-6.1.1? No more changes for runq -g currently. So I am happy with the patch accepted. And once I said in the mail that I will change the rt_rq display by runq with no argument non-hierarchically and remove the group info in it. So I made the patch. And the patch is based on the two patches for runq -g. Thanks Zhang
>From 05131abe6122763c08cab42afe80043ab5d00006 Mon Sep 17 00:00:00 2001 From: Zhang Yanfei <zhangyanfei@xxxxxxxxxxxxxx> Date: Wed, 14 Nov 2012 15:23:47 +0800 Subject: [PATCH] make rt_rq displayed non-hierarchically Signed-off-by: Zhang Yanfei <zhangyanfei@xxxxxxxxxxxxxx> --- task.c | 35 ++++++++++++++++------------------- 1 files changed, 16 insertions(+), 19 deletions(-) diff --git a/task.c b/task.c index 771f604..bdb5f66 100755 --- a/task.c +++ b/task.c @@ -76,7 +76,7 @@ static void dump_CFS_runqueues(void); static void print_group_header_rt(ulong, void *); static void print_parent_task_group_rt(void *, int); static int dump_tasks_in_lower_dequeued_rt_rq(int, ulong, int); -static void dump_RT_prio_array(int, ulong, char *); +static int dump_RT_prio_array(ulong, char *); static void dump_tasks_in_task_group_rt_rq(int, ulong, int); static char *get_task_group_name(ulong); static void sort_task_group_info_array(void); @@ -7885,7 +7885,7 @@ static void dump_CFS_runqueues(void) { int cpu, tot; - ulong runq, cfs_rq; + ulong runq, cfs_rq, prio_array; char *runqbuf, *cfs_rq_buf; ulong tasks_timeline ATTRIBUTE_UNUSED; struct task_context *tc; @@ -7943,8 +7943,15 @@ dump_CFS_runqueues(void) OFFSET(cfs_rq_tasks_timeline)); } - dump_RT_prio_array(0, runq + OFFSET(rq_rt) + OFFSET(rt_rq_active), + prio_array = runq + OFFSET(rq_rt) + OFFSET(rt_rq_active); + fprintf(fp, " RT PRIO_ARRAY: %lx\n", prio_array); + + tot = dump_RT_prio_array(prio_array, &runqbuf[OFFSET(rq_rt) + OFFSET(rt_rq_active)]); + if (!tot) { + INDENT(5); + fprintf(fp, "[no tasks queued]\n"); + } fprintf(fp, " CFS RB_ROOT: %lx\n", (ulong)root); @@ -8063,8 +8070,8 @@ dump_tasks_in_lower_dequeued_rt_rq(int depth, ulong rt_rq, int cpu) return tot; } -static void -dump_RT_prio_array(int depth, ulong k_prio_array, char *u_prio_array) +static int +dump_RT_prio_array(ulong k_prio_array, char *u_prio_array) { int i, c, tot, cnt, qheads; ulong offset, kvaddr, uvaddr; @@ -8075,9 +8082,6 @@ dump_RT_prio_array(int depth, ulong k_prio_array, char *u_prio_array) ulong my_q, task_addr; char *rt_rq_buf; - if (!depth) - fprintf(fp, " RT PRIO_ARRAY: %lx\n", k_prio_array); - qheads = (i = ARRAY_LENGTH(rt_prio_array_queue)) ? i : get_array_length("rt_prio_array.queue", NULL, SIZE(list_head)); @@ -8121,14 +8125,10 @@ dump_RT_prio_array(int depth, ulong k_prio_array, char *u_prio_array) SIZE(rt_rq), "rt_rq", FAULT_ON_ERROR); - INDENT(5 + 6 * depth); - fprintf(fp, "[%3d] ", i); - fprintf(fp, "GROUP RT PRIO_ARRAY: %lx\n", - my_q + OFFSET(rt_rq_active)); - tot++; - dump_RT_prio_array(depth + 1, + tot += dump_RT_prio_array( my_q + OFFSET(rt_rq_active), &rt_rq_buf[OFFSET(rt_rq_active)]); + FREEBUF(rt_rq_buf); continue; } else task_addr -= OFFSET(task_struct_rt); @@ -8136,7 +8136,7 @@ dump_RT_prio_array(int depth, ulong k_prio_array, char *u_prio_array) if (!(tc = task_to_context(task_addr))) continue; - INDENT(5 + 6 * depth); + INDENT(5); fprintf(fp, "[%3d] ", i); fprintf(fp, "PID: %-5ld TASK: %lx COMMAND: \"%s\"\n", tc->pid, tc->task, tc->comm); @@ -8145,10 +8145,7 @@ dump_RT_prio_array(int depth, ulong k_prio_array, char *u_prio_array) FREEBUF(tlist); } - if (!tot) { - INDENT(5 + 9 * depth); - fprintf(fp, "[no tasks queued]\n"); - } + return tot; } static void -- 1.7.1
-- Crash-utility mailing list Crash-utility@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/crash-utility