FreeBSD kernel kern code
sched_4bsd.c File Reference
#include <sys/cdefs.h>
#include "opt_hwpmc_hooks.h"
#include "opt_sched.h"
#include "opt_kdtrace.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/cpuset.h>
#include <sys/kernel.h>
#include <sys/ktr.h>
#include <sys/lock.h>
#include <sys/kthread.h>
#include <sys/mutex.h>
#include <sys/proc.h>
#include <sys/resourcevar.h>
#include <sys/sched.h>
#include <sys/sdt.h>
#include <sys/smp.h>
#include <sys/sysctl.h>
#include <sys/sx.h>
#include <sys/turnstile.h>
#include <sys/umtx.h>
#include <machine/pcb.h>
#include <machine/smp.h>
Include dependency graph for sched_4bsd.c:

Go to the source code of this file.

Data Structures

struct  td_sched
 
struct  pcpuidlestat
 

Macros

#define ESTCPULIM(e)
 
#define INVERSE_ESTCPU_WEIGHT   8 /* 1 / (priorities per estcpu level). */
 
#define NICE_WEIGHT   1 /* Priorities per nice level. */
 
#define TS_NAME_LEN   (MAXCOMLEN + sizeof(" td ") + sizeof(__XSTRING(UINT_MAX)))
 
#define TDF_DIDRUN   TDF_SCHED0 /* thread actually ran. */
 
#define TDF_BOUND   TDF_SCHED1 /* Bound to one CPU. */
 
#define TDF_SLICEEND   TDF_SCHED2 /* Thread time slice is over. */
 
#define TSF_AFFINITY   0x0001 /* Has a non-"full" CPU set. */
 
#define SKE_RUNQ_PCPU(ts)   ((ts)->ts_runq != 0 && (ts)->ts_runq != &runq)
 
#define THREAD_CAN_SCHED(td, cpu)   CPU_ISSET((cpu), &(td)->td_cpuset->cs_mask)
 
#define loadfactor(loadav)   (2 * (loadav))
 
#define decay_cpu(loadfac, cpu)   (((loadfac) * (cpu)) / ((loadfac) + FSCALE))
 
#define CCPU_SHIFT   11
 

Functions

 __FBSDID ("$BSDSUniX$")
 
static void setup_runqs (void)
 
static void schedcpu (void)
 
static void schedcpu_thread (void)
 
static void sched_priority (struct thread *td, u_char prio)
 
static void sched_setup (void *dummy)
 
static void maybe_resched (struct thread *td)
 
static void updatepri (struct thread *td)
 
static void resetpriority (struct thread *td)
 
static void resetpriority_thread (struct thread *td)
 
 SYSINIT (schedcpu, SI_SUB_LAST, SI_ORDER_FIRST, kproc_start,&sched_kp)
 
 SYSINIT (sched_setup, SI_SUB_RUN_QUEUE, SI_ORDER_FIRST, sched_setup, NULL)
 
static void sched_initticks (void *dummy)
 
 SYSINIT (sched_initticks, SI_SUB_CLOCKS, SI_ORDER_THIRD, sched_initticks, NULL)
 
static DPCPU_DEFINE (struct pcpuidlestat, idlestat)
 
static int sysctl_kern_quantum (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_NODE (_kern, OID_AUTO, sched, CTLFLAG_RD, 0,"Scheduler")
 
 SYSCTL_STRING (_kern_sched, OID_AUTO, name, CTLFLAG_RD,"4BSD", 0,"Scheduler name")
 
 SYSCTL_PROC (_kern_sched, OID_AUTO, quantum, CTLTYPE_INT|CTLFLAG_RW, NULL, 0, sysctl_kern_quantum,"I","Quantum for timeshare threads in microseconds")
 
 SYSCTL_INT (_kern_sched, OID_AUTO, slice, CTLFLAG_RW,&sched_slice, 0,"Quantum for timeshare threads in stathz ticks")
 
 SDT_PROVIDER_DEFINE (sched)
 
 SDT_PROBE_DEFINE3 (sched,,, change__pri,"struct thread *","struct proc *","uint8_t")
 
 SDT_PROBE_DEFINE3 (sched,,, dequeue,"struct thread *","struct proc *","void *")
 
 SDT_PROBE_DEFINE4 (sched,,, enqueue,"struct thread *","struct proc *","void *","int")
 
 SDT_PROBE_DEFINE4 (sched,,, lend__pri,"struct thread *","struct proc *","uint8_t","struct thread *")
 
 SDT_PROBE_DEFINE2 (sched,,, load__change,"int","int")
 
 SDT_PROBE_DEFINE2 (sched,,, off__cpu,"struct thread *","struct proc *")
 
 SDT_PROBE_DEFINE (sched,,, on__cpu)
 
 SDT_PROBE_DEFINE (sched,,, remain__cpu)
 
 SDT_PROBE_DEFINE2 (sched,,, surrender,"struct thread *","struct proc *")
 
static __inline void sched_load_add (void)
 
static __inline void sched_load_rem (void)
 
int maybe_preempt (struct thread *td)
 
 SYSCTL_UINT (_kern, OID_AUTO, ccpu, CTLFLAG_RD,&ccpu, 0,"")
 
void schedinit (void)
 
int sched_runnable (void)
 
int sched_rr_interval (void)
 
void sched_clock (struct thread *td)
 
void sched_exit (struct proc *p, struct thread *td)
 
void sched_exit_thread (struct thread *td, struct thread *child)
 
void sched_fork (struct thread *td, struct thread *childtd)
 
void sched_fork_thread (struct thread *td, struct thread *childtd)
 
void sched_nice (struct proc *p, int nice)
 
void sched_class (struct thread *td, int class)
 
void sched_lend_prio (struct thread *td, u_char prio)
 
void sched_unlend_prio (struct thread *td, u_char prio)
 
void sched_prio (struct thread *td, u_char prio)
 
void sched_user_prio (struct thread *td, u_char prio)
 
void sched_lend_user_prio (struct thread *td, u_char prio)
 
void sched_sleep (struct thread *td, int pri)
 
void sched_switch (struct thread *td, struct thread *newtd, int flags)
 
void sched_wakeup (struct thread *td)
 
void sched_add (struct thread *td, int flags)
 
void sched_rem (struct thread *td)
 
struct thread * sched_choose (void)
 
void sched_preempt (struct thread *td)
 
void sched_userret (struct thread *td)
 
void sched_bind (struct thread *td, int cpu)
 
void sched_unbind (struct thread *td)
 
int sched_is_bound (struct thread *td)
 
void sched_relinquish (struct thread *td)
 
int sched_load (void)
 
int sched_sizeof_proc (void)
 
int sched_sizeof_thread (void)
 
fixpt_t sched_pctcpu (struct thread *td)
 
void sched_tick (int cnt)
 
void sched_idletd (void *dummy)
 
void sched_throw (struct thread *td)
 
void sched_fork_exit (struct thread *td)
 
char * sched_tdname (struct thread *td)
 
void sched_affinity (struct thread *td)
 

Variables

static struct td_sched td_sched0
 
struct mtx sched_lock
 
static int realstathz = 127
 
static int sched_tdcnt
 
static int sched_slice = 12
 
static struct kproc_desc sched_kp
 
static struct runq runq
 
static fixpt_t ccpu = 0.95122942450071400909 * FSCALE
 

Macro Definition Documentation

#define CCPU_SHIFT   11

Definition at line 468 of file sched_4bsd.c.

Referenced by schedcpu().

#define decay_cpu (   loadfac,
  cpu 
)    (((loadfac) * (cpu)) / ((loadfac) + FSCALE))

Definition at line 450 of file sched_4bsd.c.

Referenced by schedcpu(), and updatepri().

#define ESTCPULIM (   e)
Value:
min((e), INVERSE_ESTCPU_WEIGHT * (NICE_WEIGHT * (PRIO_MAX - PRIO_MIN) - \
RQ_PPQ) + INVERSE_ESTCPU_WEIGHT - 1)
#define NICE_WEIGHT
Definition: sched_4bsd.c:84
#define INVERSE_ESTCPU_WEIGHT
Definition: sched_4bsd.c:82

Definition at line 76 of file sched_4bsd.c.

Referenced by sched_clock(), and sched_exit_thread().

#define INVERSE_ESTCPU_WEIGHT   8 /* 1 / (priorities per estcpu level). */

Definition at line 82 of file sched_4bsd.c.

Referenced by resetpriority(), and sched_clock().

#define loadfactor (   loadav)    (2 * (loadav))

Definition at line 449 of file sched_4bsd.c.

Referenced by schedcpu(), and updatepri().

#define NICE_WEIGHT   1 /* Priorities per nice level. */

Definition at line 84 of file sched_4bsd.c.

Referenced by resetpriority().

#define SKE_RUNQ_PCPU (   ts)    ((ts)->ts_runq != 0 && (ts)->ts_runq != &runq)

Definition at line 113 of file sched_4bsd.c.

Referenced by sched_add().

#define TDF_BOUND   TDF_SCHED1 /* Bound to one CPU. */

Definition at line 107 of file sched_4bsd.c.

Referenced by sched_add(), sched_affinity(), sched_bind(), sched_is_bound(), and sched_unbind().

#define TDF_DIDRUN   TDF_SCHED0 /* thread actually ran. */

Definition at line 106 of file sched_4bsd.c.

Referenced by sched_choose(), sched_switch(), and schedcpu().

#define TDF_SLICEEND   TDF_SCHED2 /* Thread time slice is over. */

Definition at line 108 of file sched_4bsd.c.

Referenced by sched_clock(), and sched_switch().

#define THREAD_CAN_SCHED (   td,
  cpu 
)    CPU_ISSET((cpu), &(td)->td_cpuset->cs_mask)

Definition at line 116 of file sched_4bsd.c.

Referenced by sched_affinity().

#define TS_NAME_LEN   (MAXCOMLEN + sizeof(" td ") + sizeof(__XSTRING(UINT_MAX)))

Definition at line 86 of file sched_4bsd.c.

#define TSF_AFFINITY   0x0001 /* Has a non-"full" CPU set. */

Definition at line 111 of file sched_4bsd.c.

Referenced by sched_add(), sched_affinity(), and sched_fork_thread().

Function Documentation

__FBSDID ( "$BSDSUniX$"  )
static DPCPU_DEFINE ( struct pcpuidlestat  ,
idlestat   
)
static
int maybe_preempt ( struct thread *  td)

Definition at line 312 of file sched_4bsd.c.

References mi_switch(), and panicstr.

Referenced by sched_add().

Here is the call graph for this function:

Here is the caller graph for this function:

static void maybe_resched ( struct thread *  td)
static

Definition at line 296 of file sched_4bsd.c.

Referenced by resetpriority_thread(), and sched_add().

Here is the caller graph for this function:

static void resetpriority ( struct thread *  td)
static

Definition at line 617 of file sched_4bsd.c.

References INVERSE_ESTCPU_WEIGHT, NICE_WEIGHT, and sched_user_prio().

Referenced by sched_clock(), sched_nice(), sched_wakeup(), and schedcpu().

Here is the call graph for this function:

Here is the caller graph for this function:

static void resetpriority_thread ( struct thread *  td)
static

Definition at line 635 of file sched_4bsd.c.

References maybe_resched(), and sched_prio().

Referenced by sched_clock(), sched_nice(), and schedcpu().

Here is the call graph for this function:

Here is the caller graph for this function:

void sched_affinity ( struct thread *  td)

Definition at line 1727 of file sched_4bsd.c.

References runq, sched_add(), sched_rem(), TDF_BOUND, THREAD_CAN_SCHED, ts, td_sched::ts_flags, td_sched::ts_runq, and TSF_AFFINITY.

Referenced by cpuset_setproc(), and cpuset_setthread().

Here is the call graph for this function:

Here is the caller graph for this function:

void sched_bind ( struct thread *  td,
int  cpu 
)

Definition at line 1521 of file sched_4bsd.c.

References mi_switch(), TDF_BOUND, ts, and td_sched::ts_runq.

Referenced by cf_set_method(), and kern_reboot().

Here is the call graph for this function:

Here is the caller graph for this function:

struct thread* sched_choose ( void  )

Definition at line 1441 of file sched_4bsd.c.

References runq, runq_choose(), runq_choose_fuzz(), runq_remove(), sched_lock, and TDF_DIDRUN.

Referenced by choosethread().

Here is the call graph for this function:

Here is the caller graph for this function:

void sched_class ( struct thread *  td,
int  class 
)

Definition at line 824 of file sched_4bsd.c.

Referenced by idle_setup(), ithread_create(), and rtp_to_pri().

Here is the caller graph for this function:

void sched_clock ( struct thread *  td)

Definition at line 727 of file sched_4bsd.c.

References ESTCPULIM, pcpuidlestat::idlecalls, INVERSE_ESTCPU_WEIGHT, pcpuidlestat::oldidlecalls, resetpriority(), resetpriority_thread(), sched_slice, TDF_SLICEEND, ts, td_sched::ts_cpticks, and td_sched::ts_slice.

Referenced by statclock_cnt().

Here is the call graph for this function:

Here is the caller graph for this function:

void sched_exit ( struct proc *  p,
struct thread *  td 
)

Definition at line 760 of file sched_4bsd.c.

References sched_exit_thread(), and sched_tdname().

Referenced by exit1().

Here is the call graph for this function:

Here is the caller graph for this function:

void sched_exit_thread ( struct thread *  td,
struct thread *  child 
)

Definition at line 771 of file sched_4bsd.c.

References ESTCPULIM, sched_load_rem(), and sched_tdname().

Referenced by sched_exit(), and thread_exit().

Here is the call graph for this function:

Here is the caller graph for this function:

void sched_fork ( struct thread *  td,
struct thread *  childtd 
)

Definition at line 786 of file sched_4bsd.c.

References sched_fork_thread().

Referenced by do_fork().

Here is the call graph for this function:

Here is the caller graph for this function:

void sched_fork_exit ( struct thread *  td)

Definition at line 1685 of file sched_4bsd.c.

References sched_lock.

Referenced by fork_exit().

Here is the caller graph for this function:

void sched_fork_thread ( struct thread *  td,
struct thread *  childtd 
)

Definition at line 792 of file sched_4bsd.c.

References cpuset_ref(), sched_lock, ts, td_sched::ts_flags, td_sched::ts_slice, and TSF_AFFINITY.

Referenced by create_thread(), kthread_add(), and sched_fork().

Here is the call graph for this function:

Here is the caller graph for this function:

void sched_idletd ( void *  dummy)

Definition at line 1634 of file sched_4bsd.c.

References Giant, pcpuidlestat::idlecalls, mi_switch(), pcpuidlestat::oldidlecalls, sched_lock, and sched_runnable().

Referenced by idle_setup().

Here is the call graph for this function:

Here is the caller graph for this function:

static void sched_initticks ( void *  dummy)
static

Definition at line 664 of file sched_4bsd.c.

References hogticks, hz, realstathz, sched_slice, and stathz.

int sched_is_bound ( struct thread *  td)

Definition at line 1549 of file sched_4bsd.c.

References TDF_BOUND.

void sched_lend_prio ( struct thread *  td,
u_char  prio 
)

Definition at line 864 of file sched_4bsd.c.

References sched_priority().

Referenced by propagate_priority(), sched_unlend_prio(), and turnstile_claim().

Here is the call graph for this function:

Here is the caller graph for this function:

void sched_lend_user_prio ( struct thread *  td,
u_char  prio 
)

Definition at line 935 of file sched_4bsd.c.

References sched_prio().

Referenced by _do_lock_pp(), do_unlock_pi(), do_unlock_pp(), umtx_pi_claim(), umtx_propagate_priority(), umtx_repropagate_priority(), and umtx_thread_cleanup().

Here is the call graph for this function:

Here is the caller graph for this function:

int sched_load ( void  )

Definition at line 1564 of file sched_4bsd.c.

References sched_tdcnt.

Referenced by loadav().

Here is the caller graph for this function:

static __inline void sched_load_add ( void  )
static

Definition at line 275 of file sched_4bsd.c.

References sched_tdcnt.

Referenced by sched_add(), sched_setup(), and sched_switch().

Here is the caller graph for this function:

static __inline void sched_load_rem ( void  )
static

Definition at line 284 of file sched_4bsd.c.

References sched_tdcnt.

Referenced by sched_exit_thread(), sched_rem(), and sched_switch().

Here is the caller graph for this function:

void sched_nice ( struct proc *  p,
int  nice 
)

Definition at line 809 of file sched_4bsd.c.

References resetpriority(), and resetpriority_thread().

Referenced by donice().

Here is the call graph for this function:

Here is the caller graph for this function:

fixpt_t sched_pctcpu ( struct thread *  td)

Definition at line 1582 of file sched_4bsd.c.

References ts, and td_sched::ts_pctcpu.

Referenced by fill_kinfo_aggregate(), fill_kinfo_thread(), proc_sum(), thread_compare(), and tty_info().

Here is the caller graph for this function:

void sched_preempt ( struct thread *  td)

Definition at line 1486 of file sched_4bsd.c.

References mi_switch().

Here is the call graph for this function:

void sched_prio ( struct thread *  td,
u_char  prio 
)
static void sched_priority ( struct thread *  td,
u_char  prio 
)
static

Definition at line 834 of file sched_4bsd.c.

References sched_add(), sched_rem(), and sched_tdname().

Referenced by sched_lend_prio(), and sched_prio().

Here is the call graph for this function:

Here is the caller graph for this function:

void sched_relinquish ( struct thread *  td)

Definition at line 1556 of file sched_4bsd.c.

References mi_switch().

Referenced by ksched_yield(), and thread_wait().

Here is the call graph for this function:

Here is the caller graph for this function:

void sched_rem ( struct thread *  td)

Definition at line 1411 of file sched_4bsd.c.

References runq, runq_remove(), sched_load_rem(), sched_lock, sched_tdname(), ts, and td_sched::ts_runq.

Referenced by sched_affinity(), and sched_priority().

Here is the call graph for this function:

Here is the caller graph for this function:

int sched_rr_interval ( void  )

Definition at line 705 of file sched_4bsd.c.

References hz, realstathz, and sched_slice.

Referenced by ksched_attach().

Here is the caller graph for this function:

int sched_runnable ( void  )

Definition at line 695 of file sched_4bsd.c.

References runq, and runq_check().

Referenced by sched_idletd().

Here is the call graph for this function:

Here is the caller graph for this function:

static void sched_setup ( void *  dummy)
static

Definition at line 651 of file sched_4bsd.c.

References sched_load_add(), and setup_runqs().

Here is the call graph for this function:

int sched_sizeof_proc ( void  )

Definition at line 1570 of file sched_4bsd.c.

Referenced by procinit().

Here is the caller graph for this function:

int sched_sizeof_thread ( void  )

Definition at line 1576 of file sched_4bsd.c.

Referenced by threadinit().

Here is the caller graph for this function:

void sched_sleep ( struct thread *  td,
int  pri 
)

Definition at line 948 of file sched_4bsd.c.

References sched_prio(), and ticks.

Referenced by sleepq_switch(), thread_suspend_one(), and thread_suspend_switch().

Here is the call graph for this function:

Here is the caller graph for this function:

void sched_switch ( struct thread *  td,
struct thread *  newtd,
int  flags 
)

Definition at line 961 of file sched_4bsd.c.

References choosethread(), sched_add(), sched_load_add(), sched_load_rem(), sched_lock, TDF_DIDRUN, TDF_SLICEEND, thread_lock_block(), and ts.

Referenced by mi_switch().

Here is the call graph for this function:

Here is the caller graph for this function:

char* sched_tdname ( struct thread *  td)

Definition at line 1700 of file sched_4bsd.c.

References snprintf(), and ts.

Referenced by mi_switch(), sched_add(), sched_exit(), sched_exit_thread(), sched_priority(), sched_rem(), and statclock_cnt().

Here is the call graph for this function:

Here is the caller graph for this function:

void sched_throw ( struct thread *  td)

Definition at line 1657 of file sched_4bsd.c.

References choosethread(), cpu_ticks, sched_lock, and ticks.

Referenced by thread_exit().

Here is the call graph for this function:

Here is the caller graph for this function:

void sched_tick ( int  cnt)

Definition at line 1626 of file sched_4bsd.c.

Referenced by hardclock_cnt(), and hardclock_cpu().

Here is the caller graph for this function:

void sched_unbind ( struct thread *  td)

Definition at line 1541 of file sched_4bsd.c.

References TDF_BOUND.

Referenced by cf_set_method().

Here is the caller graph for this function:

void sched_unlend_prio ( struct thread *  td,
u_char  prio 
)

Definition at line 880 of file sched_4bsd.c.

References sched_lend_prio(), and sched_prio().

Referenced by turnstile_disown(), and turnstile_unpend().

Here is the call graph for this function:

Here is the caller graph for this function:

void sched_user_prio ( struct thread *  td,
u_char  prio 
)

Definition at line 924 of file sched_4bsd.c.

Referenced by kproc_create(), resetpriority(), and rtp_to_pri().

Here is the caller graph for this function:

void sched_userret ( struct thread *  td)

Definition at line 1499 of file sched_4bsd.c.

Referenced by userret().

Here is the caller graph for this function:

void sched_wakeup ( struct thread *  td)

Definition at line 1091 of file sched_4bsd.c.

References resetpriority(), sched_add(), sched_slice, ts, td_sched::ts_slice, td_sched::ts_slptime, and updatepri().

Referenced by setrunnable().

Here is the call graph for this function:

Here is the caller graph for this function:

static void schedcpu ( void  )
static

Definition at line 476 of file sched_4bsd.c.

References allproc_lock, averunnable, ccpu, CCPU_SHIFT, decay_cpu, loadfactor, realstathz, resetpriority(), resetpriority_thread(), TDF_DIDRUN, ts, td_sched::ts_cpticks, td_sched::ts_pctcpu, td_sched::ts_slptime, and updatepri().

Referenced by schedcpu_thread().

Here is the call graph for this function:

Here is the caller graph for this function:

static void schedcpu_thread ( void  )
static

Definition at line 577 of file sched_4bsd.c.

References hz, pause(), and schedcpu().

Here is the call graph for this function:

void schedinit ( void  )

Definition at line 682 of file sched_4bsd.c.

References mtx_init(), proc0, sched_lock, sched_slice, td_sched0, and td_sched::ts_slice.

Referenced by proc0_init().

Here is the call graph for this function:

Here is the caller graph for this function:

SDT_PROBE_DEFINE ( sched  ,
on__cpu   
)
SDT_PROBE_DEFINE ( sched  ,
remain__cpu   
)
SDT_PROBE_DEFINE2 ( sched  ,
load__change  ,
"int"  ,
"int"   
)
SDT_PROBE_DEFINE2 ( sched  ,
off__cpu  ,
"struct thread *"  ,
"struct proc *"   
)
SDT_PROBE_DEFINE2 ( sched  ,
surrender  ,
"struct thread *"  ,
"struct proc *"   
)
SDT_PROBE_DEFINE3 ( sched  ,
change__pri  ,
"struct thread *"  ,
"struct proc *"  ,
"uint8_t"   
)
SDT_PROBE_DEFINE3 ( sched  ,
dequeue  ,
"struct thread *"  ,
"struct proc *"  ,
"void *"   
)
SDT_PROBE_DEFINE4 ( sched  ,
enqueue  ,
"struct thread *"  ,
"struct proc *"  ,
"void *"  ,
"int"   
)
SDT_PROBE_DEFINE4 ( sched  ,
lend__pri  ,
"struct thread *"  ,
"struct proc *"  ,
"uint8_t"  ,
"struct thread *"   
)
SDT_PROVIDER_DEFINE ( sched  )
static void setup_runqs ( void  )
static

Definition at line 176 of file sched_4bsd.c.

References runq, and runq_init().

Referenced by sched_setup().

Here is the call graph for this function:

Here is the caller graph for this function:

SYSCTL_INT ( _kern_sched  ,
OID_AUTO  ,
slice  ,
CTLFLAG_RW  ,
sched_slice,
,
"Quantum for timeshare threads in stathz ticks  
)
static int sysctl_kern_quantum ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 189 of file sched_4bsd.c.

References hogticks, hz, realstathz, sched_slice, and sysctl_handle_int().

Here is the call graph for this function:

SYSCTL_NODE ( _kern  ,
OID_AUTO  ,
sched  ,
CTLFLAG_RD  ,
,
"Scheduler"   
)
SYSCTL_PROC ( _kern_sched  ,
OID_AUTO  ,
quantum  ,
CTLTYPE_INT|  CTLFLAG_RW,
NULL  ,
,
sysctl_kern_quantum  ,
"I"  ,
"Quantum for timeshare threads in microseconds"   
)
SYSCTL_STRING ( _kern_sched  ,
OID_AUTO  ,
name  ,
CTLFLAG_RD  ,
"4BSD"  ,
,
"Scheduler name  
)
SYSCTL_UINT ( _kern  ,
OID_AUTO  ,
ccpu  ,
CTLFLAG_RD  ,
ccpu,
,
""   
)
SYSINIT ( schedcpu  ,
SI_SUB_LAST  ,
SI_ORDER_FIRST  ,
kproc_start  ,
sched_kp 
)
SYSINIT ( sched_setup  ,
SI_SUB_RUN_QUEUE  ,
SI_ORDER_FIRST  ,
sched_setup  ,
NULL   
)
SYSINIT ( sched_initticks  ,
SI_SUB_CLOCKS  ,
SI_ORDER_THIRD  ,
sched_initticks  ,
NULL   
)
static void updatepri ( struct thread *  td)
static

Definition at line 592 of file sched_4bsd.c.

References averunnable, decay_cpu, loadfactor, ts, and td_sched::ts_slptime.

Referenced by sched_wakeup(), and schedcpu().

Here is the caller graph for this function:

Variable Documentation

fixpt_t ccpu = 0.95122942450071400909 * FSCALE
static

Definition at line 453 of file sched_4bsd.c.

Referenced by schedcpu().

int realstathz = 127
static

Definition at line 122 of file sched_4bsd.c.

Referenced by sched_initticks(), sched_rr_interval(), schedcpu(), and sysctl_kern_quantum().

struct runq runq
static
struct kproc_desc sched_kp
static
Initial value:
= {
"schedcpu",
NULL
}
static void schedcpu_thread(void)
Definition: sched_4bsd.c:577

Definition at line 141 of file sched_4bsd.c.

int sched_slice = 12
static
int sched_tdcnt
static

Definition at line 123 of file sched_4bsd.c.

Referenced by sched_load(), sched_load_add(), and sched_load_rem().

struct td_sched td_sched0
static

Definition at line 119 of file sched_4bsd.c.

Referenced by schedinit().