Re: loadavg problem with 2.6.26.8-rt16 on Atmel AT91SAM9260

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 19, 2009 at 7:11 AM, Thomas Pfaff <tpfaff@xxxxxxx> wrote:
> While testing the 2.6.26.8-rt16 kernel on an AT91SAM9260-EK Arm9 board i noticed
> a small regression to 2.6.24.7-rt27.
>
> The kernel compiles and boots fine but the average load when the cpu is idle
> tends to be 1, it starts at 0 when the system boots and goes to 1 or above after
> some time.
>
> All kernels have the at91 patches from http://maxim.org.za/sam9.html
>
> Following kernels are ok:
>
> 2.6.24.7-rt27
> 2.6.26.8 without rt
>
> With the rt patch i have tested several combinations of the PREEMPT options:
>
> Without CONFIG_PREEMPT_HARDIRQ i get an oops on boot (see next mail).
>
> All other CONFIG_PREEMPT_[NONE|VOLUNTARY|DESKTOP|RT] options are working but
> with the wrong average load.

Please test the following patch.  I think you should find it fixes the problem.

Paul.
From 10906efab35b6f561defce7a90a2967a547de5f2 Mon Sep 17 00:00:00 2001
From: Paul Gortmaker <paul.gortmaker@xxxxxxxxxxxxx>
Date: Mon, 26 Jan 2009 21:15:32 -0500
Subject: [PATCH] softirq loadavg: one less active task in PREEMPT_SOFTIRQ loadavg calc

Building with a typical RT .config, but with just PREEMPT_RT disabled,
one gets a kernel that constantly shows a loadavg of one.

When RT is enabled, we subtract one from the nr_active since there is
a loadavg thread which calls calc_load().  But in the PREEMPT_SOFTIRQ
case, we should also subtract one, since we are still calling it from
a thread, as it is called as follows:

init_timers()
	\_ open_softirq(..., run_timer_softirq, ...)

run_timer_softirq()
	\_ update_times()
		\_ ifndef PREEMPT_RT calc_load()
			\_ count_active_tasks()
				\_ nr_active(), or nr_active()-1 for RT.

For reference, the original RT patch that introduces the -1 is
preempt-realtime-timer.patch, then bz235099-idle-load-fix.patch
updates it to add/mention the threaded calculation for RT.

Signed-off-by: Paul Gortmaker <paul.gortmaker@xxxxxxxxxxxxx>
---
 kernel/timer.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/kernel/timer.c b/kernel/timer.c
index 4df2d50..eae813a 100644
--- a/kernel/timer.c
+++ b/kernel/timer.c
@@ -1065,9 +1065,12 @@ static unsigned long count_active_tasks(void)
 {
 	/*
 	 * On PREEMPT_RT, we are running in the loadavg thread,
-	 * so consider 1 less running tasks:
+	 * and similarly if we are only running PREEMPT_SOFTIRQS we
+	 * are running in the run_timer_softirq thread, so consider
+	 * one less running task in these two cases. (PREEMPT_RT
+	 * selects PREEMPT_SOFTIRQ, so we get both via the latter)
 	 */
-#ifdef CONFIG_PREEMPT_RT
+#ifdef CONFIG_PREEMPT_SOFTIRQS
 	return (nr_active() - 1) * FIXED_1;
 #else
 	return nr_active() * FIXED_1;
-- 
1.6.0.4


[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux