cvs commit: src/sys/kern kern_synch.c src/sys/sys systm.h

Matthew Dillon dillon at crater.dragonflybsd.org
Fri May 26 18:59:30 PDT 2006


dillon      2006/05/26 18:51:27 PDT

DragonFly src repository

  Modified files:
    sys/kern             kern_synch.c 
    sys/sys              systm.h 
  Log:
  Implement msleep().  This function is similar to the FreeBSD msleep() except
  it interlocks with a spinlock instead of a mutex.  The spinlock must be
  exclusively held on entry.  msleep() will atomically sleep and release the
  spinlock, then reacquire the spinlock when it wakes up.
  
  A novel approach to the interlock is used.  DragonFly's tsleep/wakeup
  mechanism is a per-cpu mechanism, with a local array of cpu masks, one
  entry per hash index.  A wakeup simpy sends an IPI message to each target
  cpu whos bitmap bit is set in the ident's hash entry.
  
  This allows us to interlock simply by entering a critical section and
  setting our bit, then releasing the mutex, then tsleep()ing as per normal.
  No additional locks are required.  The critical section will delay any wakeup
  race with us simply by delaying the IPI message that is potentially
  in-transit to our cpu.
  
  Requested-by: Numerous people, and its time has come now.
  
  Revision  Changes    Path
  1.62      +37 -3     src/sys/kern/kern_synch.c
  1.38      +3 -1      src/sys/sys/systm.h


http://www.dragonflybsd.org/cvsweb/src/sys/kern/kern_synch.c.diff?r1=1.61&r2=1.62&f=u
http://www.dragonflybsd.org/cvsweb/src/sys/sys/systm.h.diff?r1=1.37&r2=1.38&f=u





More information about the Commits mailing list