FreeBSD kernel kern code
|
#include <sys/cdefs.h>
#include "opt_sleepqueue_profiling.h"
#include "opt_ddb.h"
#include "opt_kdtrace.h"
#include "opt_sched.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/lock.h>
#include <sys/kernel.h>
#include <sys/ktr.h>
#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/sbuf.h>
#include <sys/sched.h>
#include <sys/sdt.h>
#include <sys/signalvar.h>
#include <sys/sleepqueue.h>
#include <sys/sysctl.h>
#include <vm/uma.h>
Go to the source code of this file.
Data Structures | |
struct | sleepqueue |
struct | sleepqueue_chain |
Macros | |
#define | SC_TABLESIZE 128 /* Must be power of 2. */ |
#define | SC_MASK (SC_TABLESIZE - 1) |
#define | SC_SHIFT 8 |
#define | SC_HASH(wc) (((uintptr_t)(wc) >> SC_SHIFT) & SC_MASK) |
#define | SC_LOOKUP(wc) &sleepq_chains[SC_HASH(wc)] |
#define | NR_SLEEPQS 2 |
Functions | |
__FBSDID ("$BSDSUniX$") | |
static int | sleepq_catch_signals (void *wchan, int pri) |
static int | sleepq_check_signals (void) |
static int | sleepq_check_timeout (void) |
static int | sleepq_init (void *mem, int size, int flags) |
static int | sleepq_resume_thread (struct sleepqueue *sq, struct thread *td, int pri) |
static void | sleepq_switch (void *wchan, int pri) |
static void | sleepq_timeout (void *arg) |
SDT_PROBE_DECLARE (sched,,, sleep) | |
SDT_PROBE_DECLARE (sched,,, wakeup) | |
void | init_sleepqueues (void) |
struct sleepqueue * | sleepq_alloc (void) |
void | sleepq_free (struct sleepqueue *sq) |
void | sleepq_lock (void *wchan) |
struct sleepqueue * | sleepq_lookup (void *wchan) |
void | sleepq_release (void *wchan) |
void | sleepq_add (void *wchan, struct lock_object *lock, const char *wmesg, int flags, int queue) |
void | sleepq_set_timeout (void *wchan, int timo) |
u_int | sleepq_sleepcnt (void *wchan, int queue) |
void | sleepq_wait (void *wchan, int pri) |
int | sleepq_wait_sig (void *wchan, int pri) |
int | sleepq_timedwait (void *wchan, int pri) |
int | sleepq_timedwait_sig (void *wchan, int pri) |
int | sleepq_type (void *wchan) |
int | sleepq_signal (void *wchan, int flags, int pri, int queue) |
int | sleepq_broadcast (void *wchan, int flags, int pri, int queue) |
void | sleepq_remove (struct thread *td, void *wchan) |
int | sleepq_abort (struct thread *td, int intrval) |
Variables | |
static struct sleepqueue_chain | sleepq_chains [SC_TABLESIZE] |
static uma_zone_t | sleepq_zone |
#define NR_SLEEPQS 2 |
Definition at line 99 of file subr_sleepqueue.c.
Referenced by sleepq_add(), sleepq_init(), sleepq_resume_thread(), and sleepq_sleepcnt().
Definition at line 97 of file subr_sleepqueue.c.
#define SC_LOOKUP | ( | wc | ) | &sleepq_chains[SC_HASH(wc)] |
Definition at line 98 of file subr_sleepqueue.c.
Referenced by sleepq_add(), sleepq_catch_signals(), sleepq_lock(), sleepq_lookup(), sleepq_release(), sleepq_resume_thread(), sleepq_set_timeout(), sleepq_switch(), and sleepq_timeout().
#define SC_MASK (SC_TABLESIZE - 1) |
Definition at line 95 of file subr_sleepqueue.c.
#define SC_SHIFT 8 |
Definition at line 96 of file subr_sleepqueue.c.
#define SC_TABLESIZE 128 /* Must be power of 2. */ |
Definition at line 94 of file subr_sleepqueue.c.
Referenced by init_sleepqueues().
__FBSDID | ( | "$BSDSUniX$" | ) |
void init_sleepqueues | ( | void | ) |
Definition at line 176 of file subr_sleepqueue.c.
References mtx_init(), SC_TABLESIZE, sleepq_alloc(), sleepq_chains, sleepq_init(), sleepq_zone, and snprintf().
Referenced by sleepinit().
SDT_PROBE_DECLARE | ( | sched | , |
sleep | |||
) |
SDT_PROBE_DECLARE | ( | sched | , |
wakeup | |||
) |
int sleepq_abort | ( | struct thread * | td, |
int | intrval | ||
) |
Definition at line 986 of file subr_sleepqueue.c.
References sleepq_lookup(), and sleepq_resume_thread().
Referenced by tdsendsignal(), tdsigwakeup(), and thread_single().
void sleepq_add | ( | void * | wchan, |
struct lock_object * | lock, | ||
const char * | wmesg, | ||
int | flags, | ||
int | queue | ||
) |
Definition at line 281 of file subr_sleepqueue.c.
References NR_SLEEPQS, SC_LOOKUP, and sleepq_lookup().
Referenced by __lockmgr_args(), _callout_stop_safe(), _cv_timedwait(), _cv_timedwait_sig(), _cv_wait(), _cv_wait_sig(), _cv_wait_unlock(), _sleep(), _sx_slock_hard(), _sx_xlock_hard(), msleep_spin(), and sleeplk().
struct sleepqueue* sleepq_alloc | ( | void | ) |
Definition at line 214 of file subr_sleepqueue.c.
References sleepq_zone.
Referenced by init_sleepqueues(), and thread_init().
int sleepq_broadcast | ( | void * | wchan, |
int | flags, | ||
int | pri, | ||
int | queue | ||
) |
Definition at line 846 of file subr_sleepqueue.c.
References sleepq_lookup(), and sleepq_resume_thread().
Referenced by __lockmgr_args(), _sx_downgrade(), _sx_sunlock_hard(), _sx_xunlock_hard(), cv_broadcastpri(), wakeup(), and wakeupshlk().
|
static |
Definition at line 397 of file subr_sleepqueue.c.
References cursig(), panic(), SC_LOOKUP, sleepq_lookup(), sleepq_resume_thread(), sleepq_switch(), and thread_suspend_check().
Referenced by sleepq_timedwait_sig(), and sleepq_wait_sig().
|
static |
Definition at line 588 of file subr_sleepqueue.c.
Referenced by sleepq_timedwait_sig(), and sleepq_wait_sig().
|
static |
Definition at line 549 of file subr_sleepqueue.c.
References mi_switch().
Referenced by sleepq_timedwait(), and sleepq_timedwait_sig().
void sleepq_free | ( | struct sleepqueue * | sq | ) |
Definition at line 224 of file subr_sleepqueue.c.
References sleepq_zone.
Referenced by thread_fini().
|
static |
Definition at line 790 of file subr_sleepqueue.c.
References NR_SLEEPQS.
Referenced by init_sleepqueues().
void sleepq_lock | ( | void * | wchan | ) |
Definition at line 234 of file subr_sleepqueue.c.
References SC_LOOKUP.
Referenced by __lockmgr_args(), _callout_stop_safe(), _cv_timedwait(), _cv_timedwait_sig(), _cv_wait(), _cv_wait_sig(), _cv_wait_unlock(), _sleep(), _sx_downgrade(), _sx_slock_hard(), _sx_sunlock_hard(), _sx_xlock_hard(), _sx_xunlock_hard(), cv_broadcastpri(), cv_destroy(), cv_signal(), msleep_spin(), sleepq_remove(), sleepq_type(), wakeup(), wakeup_one(), and wakeupshlk().
struct sleepqueue* sleepq_lookup | ( | void * | wchan | ) |
Definition at line 248 of file subr_sleepqueue.c.
References SC_LOOKUP.
Referenced by cv_destroy(), sleepq_abort(), sleepq_add(), sleepq_broadcast(), sleepq_catch_signals(), sleepq_remove(), sleepq_signal(), sleepq_sleepcnt(), sleepq_switch(), sleepq_timeout(), and sleepq_type().
void sleepq_release | ( | void * | wchan | ) |
Definition at line 266 of file subr_sleepqueue.c.
References SC_LOOKUP.
Referenced by __lockmgr_args(), _callout_stop_safe(), _cv_timedwait(), _cv_timedwait_sig(), _cv_wait(), _cv_wait_sig(), _cv_wait_unlock(), _sleep(), _sx_downgrade(), _sx_slock_hard(), _sx_sunlock_hard(), _sx_xlock_hard(), _sx_xunlock_hard(), cv_broadcastpri(), cv_destroy(), cv_signal(), msleep_spin(), sleepq_remove(), sleepq_type(), wakeup(), wakeup_one(), and wakeupshlk().
void sleepq_remove | ( | struct thread * | td, |
void * | wchan | ||
) |
Definition at line 947 of file subr_sleepqueue.c.
References sleepq_lock(), sleepq_lookup(), sleepq_release(), and sleepq_resume_thread().
Referenced by _sleep().
|
static |
Definition at line 707 of file subr_sleepqueue.c.
References NR_SLEEPQS, SC_LOOKUP, sched_prio(), setrunnable(), and wakeup().
Referenced by sleepq_abort(), sleepq_broadcast(), sleepq_catch_signals(), sleepq_remove(), sleepq_signal(), sleepq_switch(), and sleepq_timeout().
void sleepq_set_timeout | ( | void * | wchan, |
int | timo | ||
) |
Definition at line 360 of file subr_sleepqueue.c.
References SC_LOOKUP, and sleepq_timeout().
Referenced by _cv_timedwait(), _cv_timedwait_sig(), _sleep(), msleep_spin(), and sleeplk().
int sleepq_signal | ( | void * | wchan, |
int | flags, | ||
int | pri, | ||
int | queue | ||
) |
Definition at line 809 of file subr_sleepqueue.c.
References sleepq_lookup(), and sleepq_resume_thread().
Referenced by cv_signal(), and wakeup_one().
u_int sleepq_sleepcnt | ( | void * | wchan, |
int | queue | ||
) |
Definition at line 378 of file subr_sleepqueue.c.
References NR_SLEEPQS, and sleepq_lookup().
Referenced by __lockmgr_args(), _sx_xunlock_hard(), and wakeupshlk().
|
static |
Definition at line 490 of file subr_sleepqueue.c.
References mi_switch(), panic(), SC_LOOKUP, sched_sleep(), sleepq_lookup(), sleepq_resume_thread(), and thread_lock_set().
Referenced by sleepq_catch_signals(), sleepq_timedwait(), and sleepq_wait().
int sleepq_timedwait | ( | void * | wchan, |
int | pri | ||
) |
Definition at line 645 of file subr_sleepqueue.c.
References sleepq_check_timeout(), and sleepq_switch().
Referenced by _cv_timedwait(), _sleep(), msleep_spin(), and sleeplk().
int sleepq_timedwait_sig | ( | void * | wchan, |
int | pri | ||
) |
Definition at line 665 of file subr_sleepqueue.c.
References sleepq_catch_signals(), sleepq_check_signals(), and sleepq_check_timeout().
Referenced by _cv_timedwait_sig(), _sleep(), and sleeplk().
|
static |
Definition at line 877 of file subr_sleepqueue.c.
References SC_LOOKUP, setrunnable(), sleepq_lookup(), and sleepq_resume_thread().
Referenced by sleepq_set_timeout().
int sleepq_type | ( | void * | wchan | ) |
Definition at line 684 of file subr_sleepqueue.c.
References sleepq_lock(), sleepq_lookup(), sleepq_release(), and type.
void sleepq_wait | ( | void * | wchan, |
int | pri | ||
) |
Definition at line 611 of file subr_sleepqueue.c.
References sleepq_switch().
Referenced by __lockmgr_args(), _callout_stop_safe(), _cv_wait(), _cv_wait_unlock(), _sleep(), _sx_slock_hard(), _sx_xlock_hard(), msleep_spin(), and sleeplk().
int sleepq_wait_sig | ( | void * | wchan, |
int | pri | ||
) |
Definition at line 627 of file subr_sleepqueue.c.
References sleepq_catch_signals(), and sleepq_check_signals().
Referenced by _cv_wait_sig(), _sleep(), _sx_slock_hard(), _sx_xlock_hard(), and sleeplk().
|
static |
Definition at line 150 of file subr_sleepqueue.c.
Referenced by init_sleepqueues().
|
static |
Definition at line 151 of file subr_sleepqueue.c.
Referenced by init_sleepqueues(), sleepq_alloc(), and sleepq_free().