Re: [patch-mm 01/23] NOHZ: Fix ARM,SH,SPARC64 idle nohz handling

From: Paul Mundt
Date: Sun Jun 10 2007 - 20:27:47 EST


On Sun, Jun 10, 2007 at 09:43:59AM -0000, Thomas Gleixner wrote:
> Index: linux-2.6.22-rc4-mm/arch/sh/kernel/process.c
> ===================================================================
> --- linux-2.6.22-rc4-mm.orig/arch/sh/kernel/process.c 2007-06-10 10:44:38.000000000 +0200
> +++ linux-2.6.22-rc4-mm/arch/sh/kernel/process.c 2007-06-10 10:44:38.000000000 +0200
> @@ -62,8 +62,10 @@ void default_idle(void)
> clear_thread_flag(TIF_POLLING_NRFLAG);
> smp_mb__after_clear_bit();
> set_bl_bit();
> - while (!need_resched())
> + while (!need_resched()) {
> + tick_nohz_stop_sched_tick();
> cpu_sleep();
> + }
> clear_bl_bit();
> set_thread_flag(TIF_POLLING_NRFLAG);
> } else
> @@ -82,7 +84,6 @@ void cpu_idle(void)
> if (!idle)
> idle = default_idle;
>
> - tick_nohz_stop_sched_tick();
> while (!need_resched())
> idle();
> tick_nohz_restart_sched_tick();

There are two paths here depending on hlt/nohlt setting, we need to have
tick_nohz_stop_sched_tick() for the TIF_POLLING_NRFLAG case, too.

Signed-off-by: Paul Mundt <lethal@xxxxxxxxxxxx>

--

diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c
index a11e2aa..42e156b 100644
--- a/arch/sh/kernel/process.c
+++ b/arch/sh/kernel/process.c
@@ -62,13 +62,17 @@ void default_idle(void)
clear_thread_flag(TIF_POLLING_NRFLAG);
smp_mb__after_clear_bit();
set_bl_bit();
- while (!need_resched())
+ while (!need_resched()) {
+ tick_nohz_stop_sched_tick();
cpu_sleep();
+ }
clear_bl_bit();
set_thread_flag(TIF_POLLING_NRFLAG);
} else
- while (!need_resched())
+ while (!need_resched()) {
+ tick_nohz_stop_sched_tick();
cpu_relax();
+ }
}

void cpu_idle(void)
@@ -82,7 +86,6 @@ void cpu_idle(void)
if (!idle)
idle = default_idle;

- tick_nohz_stop_sched_tick();
while (!need_resched())
idle();
tick_nohz_restart_sched_tick();
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/