On Thu, 2007-08-16 at 21:37 -0300, Luis Claudio R. Goncalves wrote:
> Hello,
> 
> The values in /proc/loadavgrt are sometimes the real load and sometimes
> garbage. As you can see in th tests below, it occurs from in 2.6.21.5-rt20 
> to 2.6.23-rc2-rt2. The code for calc_load(), in kernel/timer.c has not
> changed much in -rt patches.

> 
> Signed-off-by: Luis Claudio R. Goncalves <[EMAIL PROTECTED]>
> ---
> 
> diff --git a/kernel/sched.c b/kernel/sched.c
> index 811a502..c61609a 100644
> --- a/kernel/sched.c
> +++ b/kernel/sched.c
> @@ -2520,6 +2520,13 @@ unsigned long rt_nr_uninterruptible(void)
>       for_each_online_cpu(i)
>               sum += cpu_rq(i)->rt_nr_uninterruptible;
>  
> +     /*
> +      * Since we read the counters lockless, it might be slightly
> +      * inaccurate. Do not allow it to go below zero though:
> +      */
> +     if (unlikely((long)sum < 0))
> +             sum = 0;
> +
>       return sum;
>  }
>  
> diff --git a/linux-2.6.21.x86_64/kernel/timer.c 
> b/linux-2.6.21.x86_64_lc/kernel/timer.c
> index 882ca9d..0e49bf6 100644
> --- a/linux-2.6.21.x86_64/kernel/timer.c
> +++ b/linux-2.6.21.x86_64_lc/kernel/timer.c
> @@ -1432,23 +1432,25 @@ unsigned long avenrun_rt[3];
>  static inline void calc_load(unsigned long ticks)
>  {
>       unsigned long active_tasks; /* fixed-point */
> +     unsigned long active_rt_tasks; /* fixed-point */
>       static int count = LOAD_FREQ;
>  
>       count -= ticks;
>       if (unlikely(count < 0)) {
>               active_tasks = count_active_tasks();
> +             active_rt_tasks = count_active_rt_tasks();

Where is this used?

-
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

Reply via email to