FreeBSD kernel kern code
|
#include <sys/cdefs.h>
#include "opt_ktrace.h"
#include "opt_sched.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/blockcount.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.
Functions | |
__FBSDID ("$FreeBSD$") | |
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, "Fixed-point scale factor used for calculating load average values") | |
static void | loadav (void *arg) |
SDT_PROVIDER_DECLARE (sched) | |
SDT_PROBE_DEFINE (sched,,, preempt) | |
static void | sleepinit (void *unused) |
SYSINIT (sleepinit, SI_SUB_KMEM, SI_ORDER_ANY, sleepinit, NULL) | |
int | _sleep (const void *ident, struct lock_object *lock, int priority, const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags) |
int | msleep_spin_sbt (const void *ident, struct mtx *mtx, const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags) |
int | pause_sbt (const char *wmesg, sbintime_t sbt, sbintime_t pr, int flags) |
void | wakeup (const void *ident) |
void | wakeup_one (const void *ident) |
void | wakeup_any (const void *ident) |
void | _blockcount_wakeup (blockcount_t *bc, u_int old) |
int | _blockcount_sleep (blockcount_t *bc, struct lock_object *lock, const char *wmesg, int prio) |
static void | kdb_switch (void) |
void | mi_switch (int flags) |
int | setrunnable (struct thread *td, int srqflags) |
int | should_yield (void) |
void | maybe_yield (void) |
void | kern_yield (int prio) |
int | sys_yield (struct thread *td, struct yield_args *uap) |
int | sys_sched_getcpu (struct thread *td, struct sched_getcpu_args *uap) |
Variables | |
int | hogticks |
static const char | pause_wchan [MAXCPU] |
static struct callout | loadav_callout |
struct loadavg | averunnable |
static fixpt_t | cexp [3] |
__FBSDID | ( | "$FreeBSD$" | ) |
int _blockcount_sleep | ( | blockcount_t * | bc, |
struct lock_object * | lock, | ||
const char * | wmesg, | ||
int | prio | ||
) |
Definition at line 414 of file kern_synch.c.
References Giant, sleepq_add(), sleepq_lock(), sleepq_release(), sleepq_wait(), and sleepq_wait_sig().
void _blockcount_wakeup | ( | blockcount_t * | bc, |
u_int | old | ||
) |
Definition at line 395 of file kern_synch.c.
References wakeup().
int _sleep | ( | const void * | ident, |
struct lock_object * | lock, | ||
int | priority, | ||
const char * | wmesg, | ||
sbintime_t | sbt, | ||
sbintime_t | pr, | ||
int | flags | ||
) |
Definition at line 135 of file kern_synch.c.
References flags, Giant, pause_wchan, pr, priority, sleepq_add(), sleepq_lock(), sleepq_release(), sleepq_set_timeout_sbt(), sleepq_timedwait(), sleepq_timedwait_sig(), sleepq_wait(), and sleepq_wait_sig().
Referenced by pause_sbt().
|
static |
Definition at line 477 of file kern_synch.c.
References kdb_backtrace(), kdb_reenter(), and panic().
Referenced by mi_switch().
void kern_yield | ( | int | prio | ) |
Definition at line 660 of file kern_synch.c.
References mi_switch(), and sched_prio().
Referenced by __mnt_vnode_next_all(), __mnt_vnode_next_lazy(), buf_daemon(), fail_point_eval_nontrivial(), getblkx(), maybe_yield(), mnt_vnode_next_lazy(), stop_all_proc(), userland_sysctl(), vlrureclaim(), vn_rdwr_inchunks(), and vnlru_proc().
|
static |
Definition at line 612 of file kern_synch.c.
References averunnable, cexp, loadav(), loadav_callout, and sched_load().
Referenced by loadav(), and synch_setup().
void maybe_yield | ( | void | ) |
Definition at line 652 of file kern_synch.c.
References kern_yield(), and should_yield().
Referenced by __umtx_op_nwake_private_compat32(), __umtx_op_nwake_private_native(), boottrace_display(), bufspace_daemon(), flushbufqueues(), mnt_vnode_next_lazy_relock(), uiomove_faultflag(), vn_deallocate_impl(), and vn_fallocate().
void mi_switch | ( | int | flags | ) |
Definition at line 491 of file kern_synch.c.
References cpu_ticks, flags, Giant, kdb_active, kdb_switch(), sched_switch(), thread_stash(), and ticks.
Referenced by ast(), bufshutdown(), critical_exit_preempt(), epoch_block_handler_preempt(), ithread_loop(), kern_yield(), poll_idle(), sched_bind(), sched_idletd(), sched_preempt(), sched_relinquish(), sleepq_switch(), softclock_thread(), sys_yield(), thread_suspend_check(), thread_suspend_switch(), and turnstile_wait().
int msleep_spin_sbt | ( | const void * | ident, |
struct mtx * | mtx, | ||
const char * | wmesg, | ||
sbintime_t | sbt, | ||
sbintime_t | pr, | ||
int | flags | ||
) |
Definition at line 242 of file kern_synch.c.
References flags, mtx, pr, sleepq_add(), sleepq_lock(), sleepq_release(), sleepq_set_timeout_sbt(), sleepq_timedwait(), and sleepq_wait().
int pause_sbt | ( | const char * | wmesg, |
sbintime_t | sbt, | ||
sbintime_t | pr, | ||
int | flags | ||
) |
Definition at line 317 of file kern_synch.c.
References _sleep(), flags, kdb_active, pause_wchan, pr, and tick_sbt.
SDT_PROBE_DEFINE | ( | sched | , |
preempt | |||
) |
SDT_PROVIDER_DECLARE | ( | sched | ) |
int setrunnable | ( | struct thread * | td, |
int | srqflags | ||
) |
Definition at line 567 of file kern_synch.c.
References panic(), and sched_wakeup().
Referenced by sleepq_resume_thread(), thread_run_flash(), and thread_unsuspend_one().
int should_yield | ( | void | ) |
Definition at line 645 of file kern_synch.c.
References hogticks, and ticks.
Referenced by __mnt_vnode_next_all(), __mnt_vnode_next_lazy(), maybe_yield(), mnt_vnode_next_lazy(), vlrureclaim(), vop_stdallocate(), and vop_stddeallocate().
|
static |
Definition at line 106 of file kern_synch.c.
References hogticks, hz, and init_sleepqueues().
|
static |
Definition at line 636 of file kern_synch.c.
References callout_init(), loadav(), and loadav_callout.
int sys_sched_getcpu | ( | struct thread * | td, |
struct sched_getcpu_args * | uap | ||
) |
Definition at line 691 of file kern_synch.c.
int sys_yield | ( | struct thread * | td, |
struct yield_args * | uap | ||
) |
Definition at line 679 of file kern_synch.c.
References mi_switch(), and sched_prio().
SYSCTL_INT | ( | _kern | , |
OID_AUTO | , | ||
fscale | , | ||
CTLFLAG_RD | , | ||
SYSCTL_NULL_INT_PTR | , | ||
FSCALE | , | ||
"Fixed-point scale factor used for calculating load average values" | |||
) |
SYSINIT | ( | synch_setup | , |
SI_SUB_KICK_SCHEDULER | , | ||
SI_ORDER_FIRST | , | ||
synch_setup | , | ||
NULL | |||
) |
void wakeup | ( | const void * | ident | ) |
Definition at line 349 of file kern_synch.c.
References proc0, sleepq_broadcast(), sleepq_lock(), and sleepq_release().
Referenced by _blockcount_wakeup(), accept_filt_setopt(), addupc_task(), aio_bio_done_notify(), aio_kick(), aio_kick_nowait(), ald_activate(), ald_shutdown(), alq_getn(), alq_writen(), bd_flush(), bd_speedup(), bd_wakeup(), bdirtywakeup(), bdone(), biodone(), buf_daemon(), buf_daemon_shutdown(), bufobj_wdrop(), bufspace_daemon(), bufspace_daemon_shutdown(), bufspace_daemon_wakeup(), childproc_jobstate(), closef(), closefp_hl(), config_intrhook_disestablish_locked(), destroy_devl(), dounmount(), dounmount_cleanup(), epoch_drain_cb(), ether_poll_register(), eventfd_read(), eventfd_write(), eventhandler_prune_list(), exit1(), fail_point_drain(), fail_point_set(), gtaskqueue_run_locked(), gtaskqueue_terminate(), intr_event_add_handler(), intr_event_execute_handlers(), ithread_loop(), itimer_leave(), kern_msgrcv(), kern_msgsnd(), kern_ptrace(), 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(), ktls_buffer_alloc(), ktls_check_rx(), ktls_enqueue(), ktls_enqueue_to_free(), lf_advlockasync(), lf_iteratelocks_vnode(), lf_purgelocks(), lf_wakeup_lock(), linker_kldload_unbusy(), msq_remove(), pipe_direct_write(), pipe_read(), pipe_write(), pipeclose(), pps_event(), proc_reap(), proc_wkilled(), ptrace_coredump(), rangelock_calc_block(), realitexpire(), rms_wunlock(), root_mount_rel(), runningwakeup(), sem_remove(), semexit_myhook(), sf_buf_free(), sleepq_remove_thread(), softclock_call_cc(), soisconnected(), soisdisconnected(), soisdisconnecting(), soshutdown(), sowakeup(), sys_acct(), sys_semop(), sys_thr_wake(), sysctl_root_handler_locked(), taskqueue_run_locked(), taskqueue_terminate(), turnstile_unpend(), umtxq_signal_queue(), umtxq_signal_thread(), unp_pcb_lock_peer(), vfs_mount_destroy(), vfs_mountroot(), vfs_notify_upper(), vfs_unbusy(), vfs_unregister_upper(), vfs_write_resume(), vfs_write_suspend_umnt(), vn_finished_secondary_write(), vn_finished_write(), vn_open_cred(), vnlru_kick(), and vnlru_proc().
void wakeup_any | ( | const void * | ident | ) |
Definition at line 380 of file kern_synch.c.
References sleepq_lock(), and sleepq_signal().
Referenced by gtaskqueue_thread_enqueue(), and taskqueue_thread_enqueue().
void wakeup_one | ( | const void * | ident | ) |
Definition at line 369 of file kern_synch.c.
References sleepq_lock(), and sleepq_signal().
Referenced by _mqueue_recv(), _mqueue_send(), ald_daemon(), alq_flush(), alq_getn(), alq_post_flags(), alq_writen(), exec_release_args_kva(), gtaskqueue_drain_tq_active(), gtaskqueue_thread_loop(), loadimage(), pipeunlock(), rms_runlock_fallback(), rms_wunlock(), soaio_enqueue(), solisten_wakeup(), taskqueue_drain_tq_active(), taskqueue_thread_loop(), umtxq_requeue(), umtxq_signal_mask(), and umtxq_unbusy().
struct loadavg averunnable |
Definition at line 84 of file kern_synch.c.
Referenced by loadav(), schedcpu(), tty_info(), and updatepri().
|
static |
Definition at line 90 of file kern_synch.c.
Referenced by loadav().
int hogticks |
Definition at line 79 of file kern_synch.c.
Referenced by sched_initticks(), should_yield(), sleepinit(), and sysctl_kern_quantum().
|
static |
Definition at line 82 of file kern_synch.c.
Referenced by loadav(), and synch_setup().
|
static |
Definition at line 80 of file kern_synch.c.
Referenced by _sleep(), and pause_sbt().