cvs commit: src/sys/kern subr_sleepqueue.c

John Baldwin jhb at FreeBSD.org
Wed Apr 13 23:30:33 PDT 2005


jhb         2005-04-14 06:30:32 UTC

  FreeBSD src repository

  Modified files:
    sys/kern             subr_sleepqueue.c 
  Log:
  Close a race between sleepq_broadcast() and sleepq_catch_signals().
  Specifically, sleepq_broadcast() uses td_slpq for its private pending
  queue of threads that it is going to wake up after it takes them off the
  sleep queue.  The problem is that if one of the threads is actually not
  asleep yet, then we can end up with td_slpq being corrupted and/or the
  thread being made runnable at the wrong time resulting in the td_sleepqueue
  == NULL assertion failures occasionally reported under heavy load.
  
  The fix is to stop being so fancy and ditch the whole pending queue bit.
  Instead, sleepq_remove_thread() and sleepq_resume_thread() were merged
  into one function that requires the caller to hold sched_lock.  This
  fixes several places that unlocked sched_lock only to call a function
  that then locked sched_lock, so even though sched_lock is now held
  slightly longer, removing the extra lock acquires (1 pair instead of 3
  in some cases) probably makes it an overall win if you don't include the
  fact that it closes a race.  This is definitely a 5.4 candidate.
  
  PR:             kern/79693
  Submitted by:   Steven Sears stevenjsears at yahoo dot com
  MFC after:      4 days
  
  Revision  Changes    Path
  1.17      +21 -47    src/sys/kern/subr_sleepqueue.c


More information about the cvs-src mailing list