the bitrig master branch has been updated by haesbaert with 1 new commit:
commit 18f86f7e17b9eae1d54a04009dea8b18a425a2db
diff: https://github.com/bitrig/bitrig/commit/18f86f7
author: Christiano F. Haesbaert <[email protected]>
date: Tue Feb 10 21:36:44 2015 +0100
Introduce reaper_moveproc() and stop making an extra context switch
for every sys_exit().
The situation before this diff is as follows:
1 process A calls exit().
2 at some point A's proc{} goes into spc_schedstate.deadproc_list
3 the final step of exit() does cpu_switchto(idle)
4 idle takes over, and moves the contents of the deadproc_list to the
reaper list, waking up the reaper.
Step 3 incurs a trip to the idle thread just to make move the
deadproc_list from a safe context.
Awesome oder was ?
Now the situation is as follows:
1 process A calls exit().
2 at some point A's proc{} goes into spc_schedstate.deadproc_list
3 the final step of exit() does cpu_switchto(sched_chooseproc()),
which just jumps to whatever the scheduler tells us.
4 almost every process (except new processes) wakes up in
mi_switch(), so in mi_switch we move the deadprocs to the reaper.
We cannot move the deadproc to the reaper directly as the reaper might
start to run in another cpu and reap us while we are still onproc. So
this dance is necessary. There are other ways to improve this as well,
but as a first step this should be enough.
This also eliminates a harmless sleeper/waker race in the reaper.
ok pedro@
M sys/kern/kern_exit.c
M sys/kern/kern_fork.c
M sys/kern/kern_sched.c
M sys/kern/sched_bsd.c
M sys/sys/proc.h