Skip to contentSkip to conversation

NOHZ: Properly feed cpufreq ondemand governor

PATCH In review [email protected] 4 participants 9 messages May 25, 2009 – May 27, 2009 Nohz, dynticks support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 NOHZ: Properly feed cpufreq ondemand governor

From: Eero Nurkkala <[email protected]>

A call from irq_exit() may occasionally pause the timing info for cpufreq ondemand governor. This results in the cpufreq ondemand governor to fail to calculate the system load properly. Thus, relocate the checks for this particular case to keep the governor always functional.

---
 kernel/time/tick-sched.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
kernel/time/tick-sched.c +9 -3
index d3f1ef4..a3562ce 100644
@@ -222,6 +222,15 @@ void tick_nohz_stop_sched_tick(int inidle)
 
 	cpu = smp_processor_id();
 	ts = &per_cpu(tick_cpu_sched, cpu);
+
+	/*
+	 * Call to tick_nohz_start_idle stops the last_update_time from being
+	 * updated. Thus, it must not be called in the event we are called from
+	 * irq_exit() with the prior state different than idle.
+	 */
+	if (!inidle && !ts->inidle)
+		goto end;
+
 	now = tick_nohz_start_idle(ts);
 
 	/*
@@ -239,9 +248,6 @@ void tick_nohz_stop_sched_tick(int inidle)
 	if (unlikely(ts->nohz_mode == NOHZ_MODE_INACTIVE))
 		goto end;
 
-	if (!inidle && !ts->inidle)
-		goto end;
-
 	ts->inidle = 1;
 
 	if (need_resched())
Signature · 1 line
1.5.6.3
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · [email protected] wrote:

From: Eero Nurkkala <[email protected]>

A call from irq_exit() may occasionally pause the timing
info for cpufreq ondemand governor. This results in the
cpufreq ondemand governor to fail to calculate the system load properly. Thus, relocate the checks for this particular case to keep the governor always functional.

Signature · 1 line
All rights reversed.
#2 lore raw
Quoted 9 lines · Rik van Riel
Quoted 8 lines · [email protected] wrote:

From: Eero Nurkkala <[email protected]>

A call from irq_exit() may occasionally pause the timing info for cpufreq ondemand governor. This results in the cpufreq ondemand governor to fail to calculate the system load properly. Thus, relocate the checks for this particular case to keep the governor always functional.

Quoted 4 lines
Quoted 2 lines
#3 lore raw
In reply to [email protected]
Commit-ID:  4e67ac87c460a3c876019fa05149591122ec5287
Gitweb:     http://git.kernel.org/tip/4e67ac87c460a3c876019fa05149591122ec5287
Author:     Eero Nurkkala <[email protected]>
AuthorDate: Mon, 25 May 2009 09:57:37 +0300
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Wed, 27 May 2009 13:55:00 +0200

NOHZ: Properly feed cpufreq ondemand governor

A call from irq_exit() may occasionally pause the timing info for cpufreq ondemand governor. This results in the cpufreq ondemand governor to fail to calculate the system load properly. Thus, relocate the checks for this particular case to keep the governor always functional.

[ tglx: moved the check to the top of the function ]

LKML-Reference: <[email protected]>

---
 kernel/time/tick-sched.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
kernel/time/tick-sched.c +8 -4
index d3f1ef4..d3d6f3f 100644
@@ -218,8 +218,15 @@ void tick_nohz_stop_sched_tick(int inidle)
 	struct clock_event_device *dev = __get_cpu_var(tick_cpu_device).evtdev;
 	int cpu;
 
-	local_irq_save(flags);
+	/*
+	 * Call to tick_nohz_start_idle stops the last_update_time from being
+	 * updated. Thus, it must not be called in the event we are called from
+	 * irq_exit() with the prior state different than idle.
+	 */
+	if (!inidle && !ts->inidle)
+		return;
 
+	local_irq_save(flags);
 	cpu = smp_processor_id();
 	ts = &per_cpu(tick_cpu_sched, cpu);
 	now = tick_nohz_start_idle(ts);
@@ -239,9 +246,6 @@ void tick_nohz_stop_sched_tick(int inidle)
 	if (unlikely(ts->nohz_mode == NOHZ_MODE_INACTIVE))
 		goto end;
 
-	if (!inidle && !ts->inidle)
-		goto end;
-
 	ts->inidle = 1;
 
 	if (need_resched())
#4 lore raw
Quoted 51 lines · Nurkkala Eero.An (EXT-Offcode/Oulu)
Commit-ID:  4e67ac87c460a3c876019fa05149591122ec5287
Gitweb:     http://git.kernel.org/tip/4e67ac87c460a3c876019fa05149591122ec5287
Author:     Eero Nurkkala <[email protected]>
AuthorDate: Mon, 25 May 2009 09:57:37 +0300
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Wed, 27 May 2009 13:55:00 +0200

NOHZ: Properly feed cpufreq ondemand governor

A call from irq_exit() may occasionally pause the timing info for cpufreq ondemand governor. This results in the cpufreq ondemand governor to fail to calculate the system load properly. Thus, relocate the checks for this particular case to keep the governor always functional.

[ tglx: moved the check to the top of the function ]

LKML-Reference: <[email protected]>

---
 kernel/time/tick-sched.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
kernel/time/tick-sched.c +8 -1
index d3f1ef4..d3d6f3f 100644
@@ -218,8 +218,15 @@ void tick_nohz_stop_sched_tick(int inidle)
 	struct clock_event_device *dev = __get_cpu_var(tick_cpu_device).evtdev;
 	int cpu;
 
-	local_irq_save(flags);
+	/*
+	 * Call to tick_nohz_start_idle stops the last_update_time from being
+	 * updated. Thus, it must not be called in the event we are called from
+	 * irq_exit() with the prior state different than idle.
+	 */
+	if (!inidle && !ts->inidle)
+		return;
 
+	local_irq_save(flags);
 	cpu = smp_processor_id();
 	ts = &per_cpu(tick_cpu_sched, cpu);
 	now = tick_nohz_start_idle(ts);

kernel/time/tick-sched.c void tick_nohz_stop_sched_tick(int inidle) · line 251

Quoted 9 lines
kernel/time/tick-sched.c +0 -3
@@ -239,9 +246,6 @@ void tick_nohz_stop_sched_tick(int inidle)
 	if (unlikely(ts->nohz_mode == NOHZ_MODE_INACTIVE))
 		goto end;
 
-	if (!inidle && !ts->inidle)
-		goto end;
-
 	ts->inidle = 1;
 
 	if (need_resched())

A quick note:
Now ts is uninitialized? So ts->inidle could cause troubles, no?

#5 lore raw
Quoted 3 lines · Eero Nurkkala

A quick note:
Now ts is uninitialized? So ts->inidle could cause troubles, no?

/me is a moron.

#6 lore raw
In reply to [email protected]
Commit-ID:  cf1240033cc81216a18eec0ca71466f7fe4eeda8
Gitweb:     http://git.kernel.org/tip/cf1240033cc81216a18eec0ca71466f7fe4eeda8
Author:     Eero Nurkkala <[email protected]>
AuthorDate: Mon, 25 May 2009 09:57:37 +0300
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Wed, 27 May 2009 14:51:47 +0200

NOHZ: Properly feed cpufreq ondemand governor

A call from irq_exit() may occasionally pause the timing info for cpufreq ondemand governor. This results in the cpufreq ondemand governor to fail to calculate the system load properly. Thus, relocate the checks for this particular case to keep the governor always functional.

LKML-Reference: <[email protected]>

---
 kernel/time/tick-sched.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
kernel/time/tick-sched.c +9 -3
index d3f1ef4..233b4e7 100644
@@ -222,6 +222,15 @@ void tick_nohz_stop_sched_tick(int inidle)
 
 	cpu = smp_processor_id();
 	ts = &per_cpu(tick_cpu_sched, cpu);
+
+	/*
+	 * Call to tick_nohz_start_idle stops the last_update_time from being
+	 * updated. Thus, it must not be called in the event we are called from
+	 * irq_exit() with the prior state different than idle.
+	 */
+	if (!inidle && !ts->inidle)
+		return;
+
 	now = tick_nohz_start_idle(ts);
 
 	/*
@@ -239,9 +248,6 @@ void tick_nohz_stop_sched_tick(int inidle)
 	if (unlikely(ts->nohz_mode == NOHZ_MODE_INACTIVE))
 		goto end;
 
-	if (!inidle && !ts->inidle)
-		goto end;
-
 	ts->inidle = 1;
 
 	if (need_resched())
#7 lore raw
Quoted 33 lines · tip-bot for Eero Nurkkala
Commit-ID:  cf1240033cc81216a18eec0ca71466f7fe4eeda8
Gitweb:     http://git.kernel.org/tip/cf1240033cc81216a18eec0ca71466f7fe4eeda8
Author:     Eero Nurkkala <[email protected]>
AuthorDate: Mon, 25 May 2009 09:57:37 +0300
Committer:  Thomas Gleixner <[email protected]>
CommitDate: Wed, 27 May 2009 14:51:47 +0200

NOHZ: Properly feed cpufreq ondemand governor

A call from irq_exit() may occasionally pause the timing info for cpufreq ondemand governor. This results in the cpufreq ondemand governor to fail to calculate the system load properly. Thus, relocate the checks for this particular case to keep the governor always functional.

LKML-Reference: <[email protected]>

---
 kernel/time/tick-sched.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)
kernel/time/tick-sched.c +0 -0
index d3f1ef4..233b4e7 100644
@@ -222,6 +222,15 @@ void tick_nohz_stop_sched_tick(int inidle)
 

kernel/time/tick-sched.c void tick_nohz_stop_sched_tick(int inidle) · line 232

Quoted 10 lines
kernel/time/tick-sched.c +8 -0
 	cpu = smp_processor_id();
 	ts = &per_cpu(tick_cpu_sched, cpu);
+
+	/*
+	 * Call to tick_nohz_start_idle stops the last_update_time from being
+	 * updated. Thus, it must not be called in the event we are called from
+	 * irq_exit() with the prior state different than idle.
+	 */
+	if (!inidle && !ts->inidle)
+		return;

Calling return without restoring the local_irq_save(flags) right above the line where you get the CPU number seems like a bad idea.

Signature · 1 line
All rights reversed.
#8 lore raw
Quoted 4 lines · Rik van Riel

Calling return without restoring the local_irq_save(flags) right above the line where you get the CPU number seems like a bad idea.

I should probably stay away from keyboard today. :(