git: kernel - Fix race in multi-LWP exit

Matthew Dillon dillon at
Mon Nov 28 22:20:02 PST 2011

commit 2af9d75dac792301c2672459217b4b91c60a1d1f
Author: Matthew Dillon <dillon at>
Date:   Mon Nov 28 22:13:38 2011 -0800

    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
    * Clean up reaplwp().
    * Remove lwkt_wait_free()
    * lwkt_free_thread() now waits for td_refs to drop to 0 before freeing
      the thread.

Summary of changes:
 sys/kern/kern_exit.c   |   62 +++++++++++++++++++++++++++++++----------------
 sys/kern/lwkt_thread.c |   31 +++++++++++++-----------
 2 files changed, 58 insertions(+), 35 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list