History log of /freebsd-9.3-release/share/man/man9/sleepqueue.9
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 267654 19-Jun-2014 gjb

Copy stable/9 to releng/9.3 as part of the 9.3-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 229461 04-Jan-2012 eadler

MFC r227458, r226436:

- change "is is" to "is" or "it is"
- change "the the" to "the"
- other typo fixes

Approved by: lstewart


# 225736 22-Sep-2011 kensmith

Copy head to stable/9 as part of 9.0-RELEASE release cycle.

Approved by: re (implicit)


# 201879 08-Jan-2010 attilio

Introduce the new kernel thread called "deadlock resolver".
While the name is pretentious, a good explanation of its targets is
reported in this 17 months old presentation e-mail:
http://lists.freebsd.org/pipermail/freebsd-arch/2008-August/008452.html

In order to implement it, the sq_type in sleepqueues is mandatory and not
only compiled along with INVARIANTS option. Additively, a new sleepqueue
function, sleepq_type() is added, returning the type of the sleepqueue
linked to a wchan.
Three new sysctls are added in order to configure the thread:
debug.deadlkres.slptime_threshold
debug.deadlkres.blktime_threshold
debug.deadlkres.sleepfreq

rappresenting the thresholds for sleep and block time that will lead to
a deadlock matching (when exceeded), while the sleepfreq rappresents the
number of seconds between 2 consecutive thread runnings.
In order to enable the deadlock resolver thread recompile your kernel
with the option DEADLKRES.

Reviewed by: jeff
Tested by: pho, Giovanni Trematerra
Sponsored by: Nokia Incorporated, Sandvine Incorporated
MFC after: 2 weeks


# 200450 12-Dec-2009 kib

Document PBDRY and SLEEPQ_STOP_ON_BDRY.

Requested and reviewed by: attilio
MFC after: 3 days


# 200447 12-Dec-2009 attilio

In current code, threads performing an interruptible sleep (on both
sxlock, via the sx_{s, x}lock_sig() interface, or plain lockmgr), will
leave the waiters flag on forcing the owner to do a wakeup even when if
the waiter queue is empty.
That operation may lead to a deadlock in the case of doing a fake wakeup
on the "preferred" (based on the wakeup algorithm) queue while the other
queue has real waiters on it, because nobody is going to wakeup the 2nd
queue waiters and they will sleep indefinitively.

A similar bug, is present, for lockmgr in the case the waiters are
sleeping with LK_SLEEPFAIL on. In this case, even if the waiters queue
is not empty, the waiters won't progress after being awake but they will
just fail, still not taking care of the 2nd queue waiters (as instead the
lock owned doing the wakeup would expect).

In order to fix this bug in a cheap way (without adding too much locking
and complicating too much the semantic) add a sleepqueue interface which
does report the actual number of waiters on a specified queue of a
waitchannel (sleepq_sleepcnt()) and use it in order to determine if the
exclusive waiters (or shared waiters) are actually present on the lockmgr
(or sx) before to give them precedence in the wakeup algorithm.
This fix alone, however doesn't solve the LK_SLEEPFAIL bug. In order to
cope with it, add the tracking of how many exclusive LK_SLEEPFAIL waiters
a lockmgr has and if all the waiters on the exclusive waiters queue are
LK_SLEEPFAIL just wake both queues.

The sleepq_sleepcnt() introduction and ABI breakage require
__FreeBSD_version bumping.

Reported by: avg, kib, pho
Reviewed by: kib
Tested by: pho


# 181390 07-Aug-2008 jhb

Document the new return values for sleepq_abort(), sleepq_broadcast(), and
sleepq_signal().

Prodded by: attilio


# 172380 28-Sep-2007 gabor

- Change the description of sleepq_add(), sleepq_broadcast() and
sleepq_signal() to reflect recent changes

Submitted by: attilio
Approved by: re (bmah)


# 167387 09-Mar-2007 jhb

Allow threads to atomically release rw and sx locks while waiting for an
event. Locking primitives that support this (mtx, rw, and sx) now each
include their own foo_sleep() routine.
- Rename msleep() to _sleep() and change it's 'struct mtx' object to a
'struct lock_object' pointer. _sleep() uses the recently added
lc_unlock() and lc_lock() function pointers for the lock class of the
specified lock to release the lock while the thread is suspended.
- Add wrappers around _sleep() for mutexes (mtx_sleep()), rw locks
(rw_sleep()), and sx locks (sx_sleep()). msleep() still exists and
is now identical to mtx_sleep(), but it is deprecated.
- Rename SLEEPQ_MSLEEP to SLEEPQ_SLEEP.
- Rewrite much of sleep.9 to not be msleep(9) centric.
- Flesh out the 'RETURN VALUES' section in sleep.9 and add an 'ERRORS'
section.
- Add __nonnull(1) to _sleep() and msleep_spin() so that the compiler will
warn if you try to pass a NULL wait channel. The functions already have
a KASSERT to that effect.


# 167377 09-Mar-2007 jhb

Document SLEEPQ_PAUSE.


# 164325 15-Nov-2006 pjd

Change sleepq_add(9) argument from 'struct mtx *' to 'struct lock_object *',
which allows to use it with different kinds of locks. For example it allows
to implement Solaris conditions variables which will be used in ZFS port on
top of sx(9) locks.

Reviewed by: jhb


# 145286 19-Apr-2005 jkoshy

Bring API documentation for sleepqueue(9) in sync with the code
in -current.

Reviewed by: ru


# 140140 12-Jan-2005 ru

Scheduled mdoc(7) sweep.


# 134015 19-Aug-2004 jhb

Catch up to recent API changes including the removal of the signal_caught
argument to sleepq_timedwait() and the enhancements to the flags argument
passed to sleepq_add().


# 130843 21-Jun-2004 mpp

Spelling fixes.


# 130598 16-Jun-2004 ru

Tiny markup fixes.


# 126886 12-Mar-2004 jhb

Rewrite sleepqueue manpage to catch up to the new sleep queue interface.


# 89205 10-Jan-2002 ru

mdoc(7) police: finish up the "proc" -> "thread" conversion.


# 88509 26-Dec-2001 davidc

Update function definitions and required include files to reflect
the current state of the system.

Approved by: alfred


# 84306 01-Oct-2001 ru

mdoc(7) police: Use the new .In macro for #include statements.


# 74011 09-Mar-2001 jhb

Add 2001 to copyright.


# 71521 24-Jan-2001 ru

mdoc(7) police: fixed some minor formatting/spelling errors.


# 71441 23-Jan-2001 jhb

Document the current organization and helper functions used to implement
the sleep queues used by msleep/wakeup and friends.

Submitted by: sheldonh