summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormsmith <msmith@FreeBSD.org>2000-09-22 03:19:24 +0000
committermsmith <msmith@FreeBSD.org>2000-09-22 03:19:24 +0000
commitb2e6e23935fb9861be50729e5ca7dd953565f3b1 (patch)
treea6259deb2076ee529693bc32173d1ab7f338545b
parent5fd4296a8cbaf918bb6da046a9d5e38cc65bae23 (diff)
downloadFreeBSD-src-b2e6e23935fb9861be50729e5ca7dd953565f3b1.zip
FreeBSD-src-b2e6e23935fb9861be50729e5ca7dd953565f3b1.tar.gz
Create an event (idle_event) which is invoked every time around the
idle loop. Machine-dependant code can elect to eg. take power-saving actions when this event is invoked.
-rw-r--r--sys/kern/kern_idle.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/kern/kern_idle.c b/sys/kern/kern_idle.c
index d9f55ae..1a95e28 100644
--- a/sys/kern/kern_idle.c
+++ b/sys/kern/kern_idle.c
@@ -18,6 +18,7 @@
#include <sys/unistd.h>
#include <sys/kthread.h>
#include <sys/queue.h>
+#include <sys/eventhandler.h>
#include <vm/vm.h>
#include <vm/vm_extern.h>
#ifdef KTRACE
@@ -44,6 +45,8 @@ SYSINIT(idle_setup, SI_SUB_SCHED_IDLE, SI_ORDER_FIRST, idle_setup, NULL)
static void idle_proc(void *dummy);
+EVENTHANDLER_FAST_DEFINE(idle_event, idle_eventhandler_t);
+
/*
* setup per-cpu idle process contexts
*/
@@ -88,9 +91,13 @@ idle_proc(void *dummy)
* This is a good place to put things to be done in
* the background, including sanity checks.
*/
+
if (count++ < 0)
CTR0(KTR_PROC, "idle_proc: timed out waiting"
" for a process");
+
+ /* call out to any cpu-becoming-idle events */
+ EVENTHANDLER_FAST_INVOKE(idle_event, count);
}
mtx_enter(&sched_lock, MTX_SPIN);
OpenPOWER on IntegriCloud