- 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.
This commit is contained in:
John Baldwin 2001-02-09 14:59:43 +00:00
parent ec2e32b7fd
commit 7ecfc090c0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=72222

View File

@ -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);
}