aboutsummaryrefslogtreecommitdiffstats
path: root/xenolinux-2.4.24-sparse/arch/xeno/kernel/process.c
diff options
context:
space:
mode:
Diffstat (limited to 'xenolinux-2.4.24-sparse/arch/xeno/kernel/process.c')
-rw-r--r--xenolinux-2.4.24-sparse/arch/xeno/kernel/process.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/xenolinux-2.4.24-sparse/arch/xeno/kernel/process.c b/xenolinux-2.4.24-sparse/arch/xeno/kernel/process.c
index 3b17c7326c..ff64bccd4c 100644
--- a/xenolinux-2.4.24-sparse/arch/xeno/kernel/process.c
+++ b/xenolinux-2.4.24-sparse/arch/xeno/kernel/process.c
@@ -80,14 +80,36 @@ void enable_hlt(void)
*/
void cpu_idle (void)
{
- /* endless idle loop with no priority at all */
+ extern int set_timeout_timer(void);
+
+ /* Endless idle loop with no priority at all. */
init_idle();
current->nice = 20;
current->counter = -100;
- while (1) {
- while (!current->need_resched)
- HYPERVISOR_yield();
+ for ( ; ; )
+ {
+ while ( !current->need_resched )
+ {
+ __cli();
+ if ( current->need_resched )
+ {
+ /* The race-free check for events failed. */
+ __sti();
+ break;
+ }
+ else if ( set_timeout_timer() == 0 )
+ {
+ /* NB. Blocking reenable events in a race-free manner. */
+ HYPERVISOR_block();
+ }
+ else
+ {
+ /* No race here: yielding will get us the CPU again anyway. */
+ __sti();
+ HYPERVISOR_yield();
+ }
+ }
schedule();
check_pgt_cache();
}