On 12/21/07, Luis Claudio R. Goncalves <[EMAIL PROTECTED]> wrote:
> On Fri, Dec 21, 2007 at 10:28:39AM +0530, Jaswinder Singh wrote:
> | On Dec 20, 2007 10:19 PM, Steven Rostedt <[EMAIL PROTECTED]> wrote:
> | >
> | > So the numbers are bogus!
> | >
> |
> | Thanks, understood :)
> |
> | [EMAIL PROTECTED]:~# cat /proc/loadavg
> | 0.00 0.00 0.02 1/52 1159
> |
> | This seems loadavg is calculating average for non-RT tasks.
> |
> | I think loadavg should be loadavg(all RT Tasks) + loadavg(all non-RT
> | tasks) , it means loadavg should be all Tasks(RT + non-RT) running on
> | the machine.
> |
> | In RT we introduced loadavgrt, but we changed the meaning of loadavg.
>
> In fact, we haven't changed the meaning at all. The question is that in
> some cases the calculation happens in sync with some kernel threads
> dispatch and that makes system load _artificially_ equal to the number of
> processors in the system. Have fun reading kernel/timer.c (calc_load()) and
> understanding the logic behind it. All the answers lie there...
>
> | Currently loadavgrt is correct it is trying to calculate average of RT
> tasks.
> | But currently loadavg is loadavgnonrt, it should be loadavg (for all
> Tasks)
> |
Here is the patch which fix this problem, now loadavg >= loadavgrt
With this patch, I am getting:
[EMAIL PROTECTED]:~# cat /proc/loadavg
0.99 0.82 0.42 1/46 1013
[EMAIL PROTECTED]:~# cat /proc/loadavgrt
0.99 0.82 0.42 0/46 1014
[EMAIL PROTECTED]:~#
diff -urN linux-2.6.23-rt3.org/kernel/timer.c linux-2.6.23-rt3/kernel/timer.c
--- linux-2.6.23-rt3.org/kernel/timer.c 2007-12-22 11:50:00.000000000 +0530
+++ linux-2.6.23-rt3/kernel/timer.c 2007-12-22 12:01:10.000000000 +0530
@@ -967,13 +967,17 @@
active_rt_tasks = count_active_rt_tasks();
#endif
do {
- CALC_LOAD(avenrun[0], EXP_1, active_tasks);
- CALC_LOAD(avenrun[1], EXP_5, active_tasks);
- CALC_LOAD(avenrun[2], EXP_15, active_tasks);
#ifdef CONFIG_PREEMPT_RT
+ CALC_LOAD(avenrun[0], EXP_1, active_tasks +
active_rt_tasks);
+ CALC_LOAD(avenrun[1], EXP_5, active_tasks +
active_rt_tasks);
+ CALC_LOAD(avenrun[2], EXP_15, active_tasks +
active_rt_tasks);
CALC_LOAD(avenrun_rt[0], EXP_1, active_rt_tasks);
CALC_LOAD(avenrun_rt[1], EXP_5, active_rt_tasks);
CALC_LOAD(avenrun_rt[2], EXP_15, active_rt_tasks);
+#else
+ CALC_LOAD(avenrun[0], EXP_1, active_tasks);
+ CALC_LOAD(avenrun[1], EXP_5, active_tasks);
+ CALC_LOAD(avenrun[2], EXP_15, active_tasks);
#endif
count += LOAD_FREQ;
Thank you,
Jaswinder Singh.
-
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at http://vger.kernel.org/majordomo-info.html