mention msleep() in porting_drivers.txt

Aggelos Economopoulos aoiko at cc.ece.ntua.gr
Sun Jan 6 13:48:40 PST 2008


On Sunday 06 January 2008, Jeffrey Hsu wrote:
> Well, we do have a msleep() function.  It function atomically
> releases a lock before sleeping to ensure that no wakeup is missed.
> It is the same as the msleep() function that's currently in FreeBSD,
> except in FreeBSD it release a mutex lock and in DragonFly it
> releases a spin lock.  For short critical sections that don't block,
> substituting a spinlock and msleep() for a mutex lock and msleep()
> would be the most direct way to convert between FreeBSD and DragonFly.

Unfortunately it was not obvious from the patch context, but the added text
is part of an example of how to convert MTX_DEF FreeBSD mutexes. So I guess
this comment does not apply.

> For more complicated critical sections, it might be better to pursue
> a different MP-safety strategy entirely, such as per-cpu data along with
> crit_enter()/crit_exit().  This has lower overhead and also parallelizes,
> rather than serializes, the work load.

Agreed. The reason I didn't just add an example for MTX_SPIN mutexes is
precisely not to encourage just blindly copying FreeBSD's fine-grained
locking. Explaining alternative strategies and tradeoffs would require
a seperate article of its own though.

Aggelos





More information about the Submit mailing list