Skip to contentSkip to conversation

RT: calc_load() uses wrong variable to calculate RT load

PATCH In review Frank Rowand 2 participants 2 messages May 5, 2009 – May 6, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 RT: calc_load() uses wrong variable to calculate RT load

In calc_load() use RT tasks to calculate the RT load.

---

Ingo,

In calc_load():

#ifdef CONFIG_PREEMPT_RT
                active_rt_tasks = count_active_rt_tasks();

#endif

but active_rt_tasks is then not used. I have not read through enough code to verify my supposition, but the obvious use of this variable would be for the calculation of the RT load average.

If my supposition is correct, this patch fixes the problem.

The patch is compile tested only.

-Frank Rowand
Sony Corporation of America

kernel/timer.c +3 -3
Index: linux-2.6.29.2/kernel/timer.c
===================================================================
@@ -1249,9 +1249,9 @@ static inline void calc_load(unsigned lo
 			CALC_LOAD(avenrun[1], EXP_5, active_tasks);
 			CALC_LOAD(avenrun[2], EXP_15, active_tasks);
 #ifdef CONFIG_PREEMPT_RT
-			CALC_LOAD(avenrun_rt[0], EXP_1, active_tasks);
-			CALC_LOAD(avenrun_rt[1], EXP_5, active_tasks);
-			CALC_LOAD(avenrun_rt[2], EXP_15, active_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);
 #endif
 			count += LOAD_FREQ;
 
#1 lore raw
Quoted 12 lines · Frank Rowand

In calc_load() use RT tasks to calculate the RT load.

---

Ingo,

In calc_load():

#ifdef CONFIG_PREEMPT_RT
                active_rt_tasks = count_active_rt_tasks();
Quoted 7 lines

#endif

but active_rt_tasks is then not used. I have not read through enough code to verify my supposition, but the obvious use of this variable would be for the calculation of the RT load average.

If my supposition is correct, this patch fixes the problem.

Yep, that's correct. Though I ponder to get rid of avenrun_rt all together.

Thanks,

tglx

Quoted 24 lines

The patch is compile tested only.

-Frank Rowand
Sony Corporation of America

Index: linux-2.6.29.2/kernel/timer.c
===================================================================

kernel/timer.c +3 -3
@@ -1249,9 +1249,9 @@ static inline void calc_load(unsigned lo
 			CALC_LOAD(avenrun[1], EXP_5, active_tasks);
 			CALC_LOAD(avenrun[2], EXP_15, active_tasks);
 #ifdef CONFIG_PREEMPT_RT
-			CALC_LOAD(avenrun_rt[0], EXP_1, active_tasks);
-			CALC_LOAD(avenrun_rt[1], EXP_5, active_tasks);
-			CALC_LOAD(avenrun_rt[2], EXP_15, active_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);
 #endif
 			count += LOAD_FREQ;