summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2001-02-09 14:59:43 +0000
committerjhb <jhb@FreeBSD.org>2001-02-09 14:59:43 +0000
commit50f15894428341385fa24b96dac5db4118c2fb14 (patch)
treee2b78cf6016b8ede937c2bc18c186b6c2aadd912 /sys
parent736bcaf4bec6cc77c59eb1270c9df84378e086b8 (diff)
downloadFreeBSD-src-50f15894428341385fa24b96dac5db4118c2fb14.zip
FreeBSD-src-50f15894428341385fa24b96dac5db4118c2fb14.tar.gz
- Point out that we don't lock anything during the idle setup because
only the boot processor should be running in the comments. - Initialize curproc to point to each CPU's respective idleproc if their curproc is NULL. - Keep track of the number of context switches performed by idleproc.
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_idle.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/kern/kern_idle.c b/sys/kern/kern_idle.c
index fdf3566..e9cb529 100644
--- a/sys/kern/kern_idle.c
+++ b/sys/kern/kern_idle.c
@@ -41,7 +41,9 @@ 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
+ * Setup 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.
*/
static void
idle_setup(void *dummy)
@@ -63,6 +65,8 @@ idle_setup(void *dummy)
gd->gd_idleproc->p_flag |= P_NOLOAD;
gd->gd_idleproc->p_stat = SRUN;
+ if (gd->gd_curproc == NULL)
+ gd->gd_curproc = gd->gd_idleproc;
}
}
@@ -106,6 +110,7 @@ idle_proc(void *dummy)
}
mtx_lock_spin(&sched_lock);
+ curproc->p_stats->p_ru.ru_nvcsw++;
mi_switch();
mtx_unlock_spin(&sched_lock);
}
OpenPOWER on IntegriCloud