asmlinkage int sys_idle(void) { unsigned long start_idle = 0; if (current->pid != 0) return -EPERM; /* endless idle loop with no priority at all */ current->counter = -100; for (;;) { /* * We are locked at this point. So we can safely call * the APM bios knowing only one CPU at a time will do * so. */ if (!start_idle) start_idle = jiffies; if (jiffies - start_idle > HARD_IDLE_TIMEOUT) { hard_idle(); } else { if (hlt_works_ok && !hlt_counter && !need_resched) __asm__("hlt"); } if (need_resched) start_idle = 0; schedule(); } }
/* * The idle loop on a uniprocessor i386.. */ static int cpu_idle(void *unused) { int work = 1; unsigned long start_idle = 0; /* endless idle loop with no priority at all */ current->priority = 0; current->counter = -100; for (;;) { if (work) start_idle = jiffies; if (jiffies - start_idle > HARD_IDLE_TIMEOUT) hard_idle(); else { if (boot_cpu_data.hlt_works_ok && !hlt_counter && !current->need_resched) __asm__("hlt"); } work = current->need_resched; schedule(); check_pgt_cache(); } }