FreeBSD kernel kern code
|
#include <sys/cdefs.h>
#include "opt_kdtrace.h"
#include "opt_ktrace.h"
#include "opt_sched.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/condvar.h>
#include <sys/kdb.h>
#include <sys/kernel.h>
#include <sys/ktr.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/resourcevar.h>
#include <sys/sched.h>
#include <sys/sdt.h>
#include <sys/signalvar.h>
#include <sys/sleepqueue.h>
#include <sys/smp.h>
#include <sys/sx.h>
#include <sys/sysctl.h>
#include <sys/sysproto.h>
#include <sys/vmmeter.h>
#include <machine/cpu.h>
Go to the source code of this file.
Macros | |
#define | KTDSTATE(td) |
Functions | |
__FBSDID ("$BSDSUniX$") | |
static void | synch_setup (void *dummy) |
SYSINIT (synch_setup, SI_SUB_KICK_SCHEDULER, SI_ORDER_FIRST, synch_setup, NULL) | |
SYSCTL_INT (_kern, OID_AUTO, fscale, CTLFLAG_RD, SYSCTL_NULL_INT_PTR, FSCALE,"") | |
static void | loadav (void *arg) |
SDT_PROVIDER_DECLARE (sched) | |
SDT_PROBE_DEFINE (sched,,, preempt) | |
SDT_PROBE_DEFINE (sched,,, cpucaps__sleep) | |
SDT_PROBE_DEFINE (sched,,, cpucaps__wakeup) | |
SDT_PROBE_DEFINE (sched,,, schedctl__nopreempt) | |
SDT_PROBE_DEFINE (sched,,, schedctl__preempt) | |
SDT_PROBE_DEFINE (sched,,, schedctl__yield) | |
void | sleepinit (void) |
int | _sleep (void *ident, struct lock_object *lock, int priority, const char *wmesg, int timo) |
int | msleep_spin (void *ident, struct mtx *mtx, const char *wmesg, int timo) |
int | pause (const char *wmesg, int timo) |
void | wakeup (void *ident) |
void | wakeup_one (void *ident) |
static void | kdb_switch (void) |
void | mi_switch (int flags, struct thread *newtd) |
int | setrunnable (struct thread *td) |
int | should_yield (void) |
void | maybe_yield (void) |
void | kern_yield (int prio) |
int | sys_yield (struct thread *td, struct yield_args *uap) |
Variables | |
int | hogticks |
static int | pause_wchan |
static struct callout | loadav_callout |
struct loadavg | averunnable |
static fixpt_t | cexp [3] |
#define KTDSTATE | ( | td | ) |
Definition at line 76 of file kern_synch.c.
Referenced by mi_switch().
__FBSDID | ( | "$BSDSUniX$" | ) |
int _sleep | ( | void * | ident, |
struct lock_object * | lock, | ||
int | priority, | ||
const char * | wmesg, | ||
int | timo | ||
) |
Definition at line 147 of file kern_synch.c.
References Giant, pause_wchan, sleepq_add(), sleepq_lock(), sleepq_release(), sleepq_remove(), sleepq_set_timeout(), sleepq_timedwait(), sleepq_timedwait_sig(), sleepq_wait(), and sleepq_wait_sig().
|
static |
Definition at line 410 of file kern_synch.c.
References kdb_backtrace(), kdb_reenter(), and panic().
Referenced by mi_switch().
void kern_yield | ( | int | prio | ) |
Definition at line 592 of file kern_synch.c.
References mi_switch(), and sched_prio().
Referenced by __mnt_vnode_next(), __mnt_vnode_next_active(), __mnt_vnode_next_all(), buf_daemon(), maybe_yield(), userland_sysctl(), vlrureclaim(), vn_rdwr_inchunks(), and vnlru_proc().
|
static |
Definition at line 545 of file kern_synch.c.
References averunnable, cexp, hz, loadav_callout, and sched_load().
Referenced by synch_setup().
void maybe_yield | ( | void | ) |
Definition at line 584 of file kern_synch.c.
References kern_yield(), and should_yield().
Referenced by kern_posix_fallocate(), and uiomove_faultflag().
void mi_switch | ( | int | flags, |
struct thread * | newtd | ||
) |
Definition at line 422 of file kern_synch.c.
References cpu_ticks, Giant, kdb_active, kdb_switch(), KTDSTATE, panicstr, sched_switch(), sched_tdname(), thread_stash(), and ticks.
Referenced by ast(), critical_exit(), ithread_loop(), kern_reboot(), kern_yield(), maybe_preempt(), poll_idle(), sched_bind(), sched_idletd(), sched_preempt(), sched_relinquish(), sleepq_check_timeout(), sleepq_switch(), sys_yield(), thread_suspend_check(), thread_suspend_switch(), and turnstile_wait().
int msleep_spin | ( | void * | ident, |
struct mtx * | mtx, | ||
const char * | wmesg, | ||
int | timo | ||
) |
Definition at line 265 of file kern_synch.c.
References sleepq_add(), sleepq_lock(), sleepq_release(), sleepq_set_timeout(), sleepq_timedwait(), and sleepq_wait().
Referenced by alq_getn(), alq_shutdown(), alq_writen(), and TQ_SLEEP().
int pause | ( | const char * | wmesg, |
int | timo | ||
) |
Definition at line 350 of file kern_synch.c.
References hz, pause_wchan, and tick.
Referenced by _intr_drain(), fork1(), ithread_execute_handlers(), mnt_vnode_next_active(), parse_dir_ask(), parse_mount(), schedcpu_thread(), and syscall_thread_drain().
SDT_PROBE_DEFINE | ( | sched | , |
preempt | |||
) |
SDT_PROBE_DEFINE | ( | sched | , |
cpucaps__sleep | |||
) |
SDT_PROBE_DEFINE | ( | sched | , |
cpucaps__wakeup | |||
) |
SDT_PROBE_DEFINE | ( | sched | , |
schedctl__nopreempt | |||
) |
SDT_PROBE_DEFINE | ( | sched | , |
schedctl__preempt | |||
) |
SDT_PROBE_DEFINE | ( | sched | , |
schedctl__yield | |||
) |
SDT_PROVIDER_DECLARE | ( | sched | ) |
int setrunnable | ( | struct thread * | td | ) |
Definition at line 506 of file kern_synch.c.
References panic(), printf(), and sched_wakeup().
Referenced by sleepq_resume_thread(), sleepq_timeout(), and thread_unsuspend_one().
int should_yield | ( | void | ) |
Definition at line 577 of file kern_synch.c.
References hogticks, and ticks.
Referenced by __mnt_vnode_next(), __mnt_vnode_next_active(), __mnt_vnode_next_all(), maybe_yield(), mnt_vnode_next_active(), vlrureclaim(), and vop_stdallocate().
void sleepinit | ( | void | ) |
Definition at line 124 of file kern_synch.c.
References hogticks, hz, and init_sleepqueues().
Referenced by proc0_init().
|
static |
Definition at line 568 of file kern_synch.c.
References callout_init(), loadav(), and loadav_callout.
int sys_yield | ( | struct thread * | td, |
struct yield_args * | uap | ||
) |
Definition at line 612 of file kern_synch.c.
References mi_switch(), and sched_prio().
SYSCTL_INT | ( | _kern | , |
OID_AUTO | , | ||
fscale | , | ||
CTLFLAG_RD | , | ||
SYSCTL_NULL_INT_PTR | , | ||
FSCALE | , | ||
"" | |||
) |
SYSINIT | ( | synch_setup | , |
SI_SUB_KICK_SCHEDULER | , | ||
SI_ORDER_FIRST | , | ||
synch_setup | , | ||
NULL | |||
) |
void wakeup | ( | void * | ident | ) |
Definition at line 378 of file kern_synch.c.
References proc0, sleepq_broadcast(), sleepq_lock(), and sleepq_release().
Referenced by addupc_task(), aio_bio_done_notify(), aio_kick(), aio_kick_nowait(), ald_activate(), ald_shutdown(), alq_getn(), alq_writen(), bd_speedup(), bd_wakeup(), bdone(), biodone(), bufcountwakeup(), bufobj_wdrop(), bufspacewakeup(), bunpin(), childproc_jobstate(), closef(), config_intrhook_disestablish(), destroy_devl(), do_dup(), dounmount(), ether_poll_register(), eventhandler_prune_list(), exit1(), foffset_unlock(), getnewvnode_wait(), intr_event_add_handler(), intr_event_execute_handlers(), ithread_loop(), itimer_leave(), kern_close(), kern_msgctl(), kern_msgrcv(), kern_msgsnd(), kern_semctl(), knote_fdclose(), kproc_exit(), kproc_resume(), kproc_suspend(), kproc_suspend_check(), kqueue_release(), kqueue_task(), kqueue_wakeup(), kthread_exit(), kthread_resume(), kthread_suspend_check(), lf_advlockasync(), lf_iteratelocks_vnode(), lf_purgelocks(), lf_wakeup_lock(), numdirtywakeup(), pipe_direct_write(), pipe_read(), pipe_write(), pipeclose(), pipeunlock(), proc_reap(), rangelock_calc_block(), realitexpire(), root_mount_rel(), runningbufwakeup(), semexit_myhook(), shmget_allocate_segment(), sleepq_resume_thread(), softclock_call_cc(), soisconnected(), soisdisconnected(), soisdisconnecting(), soshutdown(), sowakeup(), stopevent(), sys_acct(), sys_semop(), sys_thr_wake(), sysctl_root(), taskqueue_run_locked(), taskqueue_terminate(), tdsendsignal(), tty_makedev(), turnstile_unpend(), umtxq_signal_queue(), umtxq_signal_thread(), vfs_mount_destroy(), vfs_mountroot(), vfs_notify_upper(), vfs_unbusy(), vfs_write_resume_flags(), vn_finished_secondary_write(), vn_finished_write(), and vnlru_proc().
void wakeup_one | ( | void * | ident | ) |
Definition at line 398 of file kern_synch.c.
References sleepq_lock(), sleepq_release(), and sleepq_signal().
Referenced by _mqueue_recv(), _mqueue_send(), ald_daemon(), alq_flush(), alq_getn(), alq_post_flags(), alq_writen(), loadimage(), soisconnected(), sonewconn(), taskqueue_thread_enqueue(), taskqueue_thread_loop(), and umtxq_unbusy().
struct loadavg averunnable |
Definition at line 92 of file kern_synch.c.
Referenced by loadav(), schedcpu(), tty_info(), and updatepri().
|
static |
Definition at line 98 of file kern_synch.c.
Referenced by loadav().
int hogticks |
Definition at line 87 of file kern_synch.c.
Referenced by sched_initticks(), should_yield(), sleepinit(), and sysctl_kern_quantum().
|
static |
Definition at line 90 of file kern_synch.c.
Referenced by loadav(), and synch_setup().
|
static |
Definition at line 88 of file kern_synch.c.