kernel - Fix race in multi-LWP exit
authorMatthew Dillon <dillon@apollo.backplane.com>
Tue, 29 Nov 2011 06:13:38 +0000 (22:13 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Tue, 29 Nov 2011 06:13:38 +0000 (22:13 -0800)
commit2af9d75dac792301c2672459217b4b91c60a1d1f
tree86919ee704bfad367b9ced5acfb74f3d2970b8a1
parent138b6cd2b75abab695d71aea0ab7642b96e24602
kernel - Fix race in multi-LWP exit

* Fix a very small race condition after TDF_EXITING could get set where a
  LWPs thread could get destroyed by another cpu (reaping it) before
  the thread actually finished exiting.

* Clean up a case where we were improperly testing TDF_RUNQ which could
  result in unnecessary 1-tick delays in exit reaping.

* Beef up the assertion when TDF_EXITING is found to be set that
  both TDF_RUNQ and TDF_TSLEEPQ are not set (before it was just checking
  TDF_TSLEEPQ).

* Clean up reaplwp().

* Remove lwkt_wait_free()

* lwkt_free_thread() now waits for td_refs to drop to 0 before freeing
  the thread.
sys/kern/kern_exit.c
sys/kern/lwkt_thread.c