diff options
author | peter <peter@FreeBSD.org> | 2003-10-19 02:43:57 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2003-10-19 02:43:57 +0000 |
commit | 7b3a8f1308890767d5506a021e706e78732e95d4 (patch) | |
tree | f2bc50e28bb16b980a9d288e4a0eafdb3d322f83 | |
parent | 05de20ae7abe6efc7ba3c8f23f9526d457433f7f (diff) | |
download | FreeBSD-src-7b3a8f1308890767d5506a021e706e78732e95d4.zip FreeBSD-src-7b3a8f1308890767d5506a021e706e78732e95d4.tar.gz |
Tidy up loose ends in the idle process. Call the MI cpu_idle() function
for all platforms now.
XXX alpha/sparc64/powerpc should fill in the function.
Submitted by: bde
-rw-r--r-- | sys/kern/kern_idle.c | 42 |
1 files changed, 5 insertions, 37 deletions
diff --git a/sys/kern/kern_idle.c b/sys/kern/kern_idle.c index 224ba63..cb273b7 100644 --- a/sys/kern/kern_idle.c +++ b/sys/kern/kern_idle.c @@ -6,25 +6,16 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -#include "opt_ktrace.h" - #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> -#include <sys/ktr.h> #include <sys/kthread.h> #include <sys/lock.h> #include <sys/mutex.h> -#include <sys/pcpu.h> #include <sys/proc.h> #include <sys/resourcevar.h> #include <sys/sched.h> -#include <sys/smp.h> #include <sys/unistd.h> -#ifdef KTRACE -#include <sys/uio.h> -#include <sys/ktrace.h> -#endif static void idle_setup(void *dummy); SYSINIT(idle_setup, SI_SUB_SCHED_IDLE, SI_ORDER_FIRST, idle_setup, NULL) @@ -32,7 +23,7 @@ SYSINIT(idle_setup, SI_SUB_SCHED_IDLE, SI_ORDER_FIRST, idle_setup, NULL) static void idle_proc(void *dummy); /* - * Setup per-cpu idle process contexts. The AP's shouldn't be running or + * Set up per-cpu idle process contexts. The AP's shouldn't be running or * accessing their idle processes at this point, so don't bother with * locking. */ @@ -78,48 +69,25 @@ idle_setup(void *dummy) } /* - * idle process context + * The actual idle process. */ static void idle_proc(void *dummy) { -#ifdef DIAGNOSTIC - int count; -#endif - struct thread *td; struct proc *p; + struct thread *td; td = curthread; p = td->td_proc; for (;;) { mtx_assert(&Giant, MA_NOTOWNED); -#ifdef DIAGNOSTIC - count = 0; - - while (count >= 0 && sched_runnable() == 0) { -#else - while (sched_runnable() == 0) { -#endif - /* - * This is a good place to put things to be done in - * the background, including sanity checks. - */ - -#ifdef DIAGNOSTIC - if (count++ < 0) - CTR0(KTR_PROC, "idle_proc: timed out waiting" - " for a process"); -#endif - -#if defined(__i386__) || defined(__amd64__) || defined(__ia64__) + while (sched_runnable() == 0) cpu_idle(); -#endif - } mtx_lock_spin(&sched_lock); - p->p_stats->p_ru.ru_nvcsw++; td->td_state = TDS_CAN_RUN; + p->p_stats->p_ru.ru_nvcsw++; mi_switch(); mtx_unlock_spin(&sched_lock); } |