于 2012年08月30日 02:30, Dave Anderson 写道:
----- Original Message -----
>> Another question re: your patch -- is it possible to have a "depth"
greater
>> than 1?
>
> Yes, "depth" could be greater than 1, see the example below:
>
> CPU 0 RUNQUEUE: ffff880028216680
> CURRENT: PID: 17085 TASK: ffff880137c63540 COMMAND: "bash"
> RT PRIO_ARRAY: ffff880028216808 <-- depth
= 0
> [ 0] PID: 17129 TASK: ffff880037aeaaa0 COMMAND: "rtloop99"
> PID: 2832 TASK: ffff88013b09cae0 COMMAND: "rtkit-daemon"
> PID: 6 TASK: ffff88013d7c6080 COMMAND: "watchdog/0"
> [ 1] GROUP RT PRIO_ARRAY: ffff88002ca65000 <-- depth
= 1
> [ 1] GROUP RT PRIO_ARRAY: ffff880015821000 <-- depth
= 2
> [ 1] PID: 17126 TASK: ffff880135d2a040 COMMAND:
"rtloop98"
> [ 98] PID: 17119 TASK: ffff88010190d500 COMMAND: "rtloop1"
> PID: 17121 TASK: ffff88013bd27500 COMMAND: "rtloop1"
> PID: 17120 TASK: ffff88010190caa0 COMMAND: "rtloop1"
> CFS RB_ROOT: ffff880028216718
...
> Hmm, I think the depth could not be that big. So how do you think this
> kind of output.
>
> The attached patch just changed "CHILD" to "GROUP".
Interesting -- how did you set up the depth-greater-than-one scenario?
Below is my script to run a number of rt tasks in different cgroups:
#!/bin/bash
mkdir /cgroup/cpu/test1
echo 850000 > /cgroup/cpu/test1/cpu.rt_runtime_us
./rtloop1 &
echo $! > /cgroup/cpu/test1/tasks
./rtloop1 &
echo $! > /cgroup/cpu/test1/tasks
./rtloop1 &
echo $! > /cgroup/cpu/test1/tasks
./rtloop98 &
echo $! > /cgroup/cpu/test1/tasks
./rtloop45 &
echo $! > /cgroup/cpu/test1/tasks
./rtloop99 &
echo $! > /cgroup/cpu/test1/tasks
mkdir /cgroup/cpu/test1/test11
echo 550000 > /cgroup/cpu/test1/test11/cpu.rt_runtime_us
./rtloop98 &
echo $! > /cgroup/cpu/test1/test11/tasks
./rtloop99 &
echo $! > /cgroup/cpu/test1/test11/tasks
./rtloop98 &
./rtloop99 &
Anyway, given that it is possible, let's at least tighten up the output display
by changing each "9 * depth" usage to be "6 * depth". That should
alter
your example output to look like this:
CPU 0 RUNQUEUE: ffff880028216680
CURRENT: PID: 17085 TASK: ffff880137c63540 COMMAND: "bash"
RT PRIO_ARRAY: ffff880028216808
[ 0] PID: 17129 TASK: ffff880037aeaaa0 COMMAND: "rtloop99"
PID: 2832 TASK: ffff88013b09cae0 COMMAND: "rtkit-daemon"
PID: 6 TASK: ffff88013d7c6080 COMMAND: "watchdog/0"
[ 1] GROUP RT PRIO_ARRAY: ffff88002ca65000
[ 1] GROUP RT PRIO_ARRAY: ffff880015821000
[ 1] PID: 17126 TASK: ffff880135d2a040 COMMAND: "rtloop98"
[ 98] PID: 17119 TASK: ffff88010190d500 COMMAND: "rtloop1"
PID: 17121 TASK: ffff88013bd27500 COMMAND: "rtloop1"
PID: 17120 TASK: ffff88010190caa0 COMMAND: "rtloop1"
CFS RB_ROOT: ffff880028216718
...
Hmm, This kind of output looks not that understandable easily...
for example:
RT PRIO_ARRAY: ffff880028296808
[ 0] GROUP RT PRIO_ARRAY: ffff880103ded800
[ 0] GROUP RT PRIO_ARRAY: ffff88011ae70800
[ 0] PID: 17127 TASK: ffff8800378f6040 COMMAND: "rtloop99"
PID: 17124 TASK: ffff8800a9592ae0 COMMAND: "rtloop99"
[ 1] PID: 17122 TASK: ffff88011aec3500 COMMAND: "rtloop98"
[ 54] PID: 17123 TASK: ffff88013b414ae0 COMMAND: "rtloop45"
PID: 10 TASK: ffff88013cc2cae0 COMMAND: "watchdog/1"
PID: 7 TASK: ffff88013d7ef500 COMMAND: "migration/1"
[ 1] PID: 17128 TASK: ffff880139761540 COMMAND: "rtloop98"
This output looks confusing, it seems that task 10 and 7 are in group
ffff880103ded800
I think we can avoid this by two ways:
1. 6 * depth --> 8 * depth, proper indentation.
RT PRIO_ARRAY: ffff880028296808
[ 0] GROUP RT PRIO_ARRAY: ffff880103ded800
[ 0] GROUP RT PRIO_ARRAY: ffff88011ae70800
[ 0] PID: 17127 TASK: ffff8800378f6040 COMMAND:
"rtloop99"
PID: 17124 TASK: ffff8800a9592ae0 COMMAND: "rtloop99"
[ 1] PID: 17122 TASK: ffff88011aec3500 COMMAND: "rtloop98"
[ 54] PID: 17123 TASK: ffff88013b414ae0 COMMAND: "rtloop45"
PID: 10 TASK: ffff88013cc2cae0 COMMAND: "watchdog/1"
PID: 7 TASK: ffff88013d7ef500 COMMAND: "migration/1"
[ 1] PID: 17128 TASK: ffff880139761540 COMMAND: "rtloop98"
2. print priority for all tasks,
RT PRIO_ARRAY: ffff880028296808
[ 0] GROUP RT PRIO_ARRAY: ffff880103ded800
[ 0] GROUP RT PRIO_ARRAY: ffff88011ae70800
[ 0] PID: 17127 TASK: ffff8800378f6040 COMMAND: "rtloop99"
[ 0] PID: 17124 TASK: ffff8800a9592ae0 COMMAND: "rtloop99"
[ 1] PID: 17122 TASK: ffff88011aec3500 COMMAND: "rtloop98"
[ 54] PID: 17123 TASK: ffff88013b414ae0 COMMAND: "rtloop45"
[ 0] PID: 10 TASK: ffff88013cc2cae0 COMMAND: "watchdog/1"
[ 0] PID: 7 TASK: ffff88013d7ef500 COMMAND: "migration/1"
[ 1] PID: 17128 TASK: ffff880139761540 COMMAND: "rtloop98"
I prefer the second one, how do you think?
And I attached 2 patches, one is for way 1, and the other is for way 2.
And also, I'd prefer to not create the dangling "static int depth",
but rather to add a depth argument to dump_RT_prio_array(), where
dump_CFS_runqueues() passes a 0, and dump_RT_prio_array() passes
"depth+1" to itself:
static void
dump_RT_prio_array(int depth, ulong k_prio_array, char *u_prio_array)
{
......
}
Can you verify that those changes work for you?
OK.
Thanks
Zhang Yanfei