linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* loadavg vs loadavgrt
@ 2007-12-20 10:35 Jaswinder Singh
  2007-12-20 16:49 ` Steven Rostedt
  0 siblings, 1 reply; 5+ messages in thread
From: Jaswinder Singh @ 2007-12-20 10:35 UTC (permalink / raw)
  To: RT, Steven Rostedt; +Cc: Ingo Molnar

Hello,

By linux-2.6.23-rt3 on ideal condition, I am getting :-

root@192.168.1.253:~# cat /proc/loadavgrt
1.00 1.00 1.00 0/52 1158
root@192.168.1.253:~# cat /proc/loadavg
0.00 0.00 0.02 1/52 1159
root@192.168.1.253:~#

I am curious:
1. Why loadavgrt is not reflecting load on loadavg

2. loadavgrt is giving correct information or it is bogus

Thank you,

Jaswinder Singh.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: loadavg vs loadavgrt
  2007-12-20 10:35 loadavg vs loadavgrt Jaswinder Singh
@ 2007-12-20 16:49 ` Steven Rostedt
  2007-12-21  4:58   ` Jaswinder Singh
  0 siblings, 1 reply; 5+ messages in thread
From: Steven Rostedt @ 2007-12-20 16:49 UTC (permalink / raw)
  To: Jaswinder Singh; +Cc: RT, Ingo Molnar


On Thu, 20 Dec 2007, Jaswinder Singh wrote:

> Hello,
>
> By linux-2.6.23-rt3 on ideal condition, I am getting :-
>
> root@192.168.1.253:~# cat /proc/loadavgrt
> 1.00 1.00 1.00 0/52 1158

This is bogus. It's a known issue, and there's a patch in the works.
The problem is that the calculation of load average is done via a softirq,
which in vanilla Linux is not a thread (nor an RT task). But in RT, all
softirqs are RT tasks, and when this calculation is performed, it sees
that there is always an RT task runnning. That RT task that it sees
running happens to be the softirq RT task that is calculating the load!

So the numbers are bogus!

-- Steve


> root@192.168.1.253:~# cat /proc/loadavg
> 0.00 0.00 0.02 1/52 1159
> root@192.168.1.253:~#
>
> I am curious:
> 1. Why loadavgrt is not reflecting load on loadavg
>
> 2. loadavgrt is giving correct information or it is bogus
>
> Thank you,
>
> Jaswinder Singh.
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: loadavg vs loadavgrt
  2007-12-20 16:49 ` Steven Rostedt
@ 2007-12-21  4:58   ` Jaswinder Singh
  2007-12-21 12:54     ` Luis Claudio R. Goncalves
  0 siblings, 1 reply; 5+ messages in thread
From: Jaswinder Singh @ 2007-12-21  4:58 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: RT, Ingo Molnar

On Dec 20, 2007 10:19 PM, Steven Rostedt <rostedt@goodmis.org> wrote:
>
> So the numbers are bogus!
>

Thanks, understood :)

root@192.168.1.253:~# 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.

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)

Please correct me, If I am wrong.

Thank you,

Jaswinder Singh.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: loadavg vs loadavgrt
  2007-12-21  4:58   ` Jaswinder Singh
@ 2007-12-21 12:54     ` Luis Claudio R. Goncalves
  2007-12-22  6:39       ` [PATCH] " Jaswinder Singh
  0 siblings, 1 reply; 5+ messages in thread
From: Luis Claudio R. Goncalves @ 2007-12-21 12:54 UTC (permalink / raw)
  To: Jaswinder Singh; +Cc: Steven Rostedt, RT, Ingo Molnar

On Fri, Dec 21, 2007 at 10:28:39AM +0530, Jaswinder Singh wrote:
| On Dec 20, 2007 10:19 PM, Steven Rostedt <rostedt@goodmis.org> wrote:
| >
| > So the numbers are bogus!
| >
| 
| Thanks, understood :)
| 
| root@192.168.1.253:~# 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)
| 
| Please correct me, If I am wrong.
| 
| Thank you,
| 
| Jaswinder Singh.
| -
| To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
| the body of a message to majordomo@vger.kernel.org
| More majordomo info at  http://vger.kernel.org/majordomo-info.html
---end quoted text---

-- 
[ Luis Claudio R. Goncalves                    Bass - Gospel - RT ]
[ Fingerprint: 4FDD B8C4 3C59 34BD 8BE9  2696 7203 D980 A448 C8F8 ]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] Re: loadavg vs loadavgrt
  2007-12-21 12:54     ` Luis Claudio R. Goncalves
@ 2007-12-22  6:39       ` Jaswinder Singh
  0 siblings, 0 replies; 5+ messages in thread
From: Jaswinder Singh @ 2007-12-22  6:39 UTC (permalink / raw)
  To: Luis Claudio R. Goncalves; +Cc: Steven Rostedt, RT, Ingo Molnar

On 12/21/07, Luis Claudio R. Goncalves <lclaudio@uudg.org> wrote:
> On Fri, Dec 21, 2007 at 10:28:39AM +0530, Jaswinder Singh wrote:
> | On Dec 20, 2007 10:19 PM, Steven Rostedt <rostedt@goodmis.org> wrote:
> | >
> | > So the numbers are bogus!
> | >
> |
> | Thanks, understood :)
> |
> | root@192.168.1.253:~# 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:
root@192.168.1.253:~# cat /proc/loadavg
0.99 0.82 0.42 1/46 1013
root@192.168.1.253:~# cat /proc/loadavgrt
0.99 0.82 0.42 0/46 1014
root@192.168.1.253:~#

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-12-22  6:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-20 10:35 loadavg vs loadavgrt Jaswinder Singh
2007-12-20 16:49 ` Steven Rostedt
2007-12-21  4:58   ` Jaswinder Singh
2007-12-21 12:54     ` Luis Claudio R. Goncalves
2007-12-22  6:39       ` [PATCH] " Jaswinder Singh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).