cvs commit: src/sys/kern kern_mutex.c kern_rwlock.c

Attilio Rao attilio at FreeBSD.org
Mon Nov 26 14:37:35 PST 2007


attilio     2007-11-26 22:37:35 UTC

  FreeBSD src repository

  Modified files:
    sys/kern             kern_mutex.c kern_rwlock.c 
  Log:
  Simplify the adaptive spinning algorithm in rwlock and mutex:
  currently, before to spin the turnstile spinlock is acquired and the
  waiters flag is set.
  This is not strictly necessary, so just spin before to acquire the
  spinlock and to set the flags.
  This will simplify a lot other functions too, as now we have the waiters
  flag set only if there are actually waiters.
  This should make wakeup/sleeping couplet faster under intensive mutex
  workload.
  This also fixes a bug in rw_try_upgrade() in the adaptive case, where
  turnstile_lookup() will recurse on the ts_lock lock that will never be
  really released [1].
  
  [1] Reported by: jeff with Nokia help
  Tested by: pho, kris (earlier, bugged version of rwlock part)
  Discussed with: jhb [2], jeff
  MFC after: 1 week
  
  [2] John had a similar patch about 6.x and/or 7.x about mutexes probabilly
  
  Revision  Changes    Path
  1.201     +41 -29    src/sys/kern/kern_mutex.c
  1.32      +72 -112   src/sys/kern/kern_rwlock.c


More information about the cvs-src mailing list