FreeBSD kernel kern code
kern_switch.c File Reference
#include <sys/cdefs.h>
#include "opt_sched.h"
#include <sys/param.h>
#include <sys/systm.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/queue.h>
#include <sys/sched.h>
#include <sys/smp.h>
#include <sys/sysctl.h>
#include <machine/cpu.h>
Include dependency graph for kern_switch.c:

Go to the source code of this file.

Macros

#define KTR_CRITICAL   0
 

Functions

 __FBSDID ("$BSDSUniX$")
 
 CTASSERT ((RQB_BPW *RQB_LEN)==RQ_NQS)
 
 SYSCTL_INT (_kern_sched, OID_AUTO, preemption, CTLFLAG_RD,&kern_sched_preemption, 0,"Kernel preemption enabled")
 
struct thread * choosethread (void)
 
void critical_enter (void)
 
void critical_exit (void)
 
void runq_init (struct runq *rq)
 
static __inline void runq_clrbit (struct runq *rq, int pri)
 
static __inline int runq_findbit (struct runq *rq)
 
static __inline int runq_findbit_from (struct runq *rq, u_char pri)
 
static __inline void runq_setbit (struct runq *rq, int pri)
 
void runq_add (struct runq *rq, struct thread *td, int flags)
 
void runq_add_pri (struct runq *rq, struct thread *td, u_char pri, int flags)
 
int runq_check (struct runq *rq)
 
struct thread * runq_choose_fuzz (struct runq *rq, int fuzz)
 
struct thread * runq_choose (struct runq *rq)
 
struct thread * runq_choose_from (struct runq *rq, u_char idx)
 
void runq_remove (struct runq *rq, struct thread *td)
 
void runq_remove_idx (struct runq *rq, struct thread *td, u_char *idx)
 

Variables

static int kern_sched_preemption = 0
 

Macro Definition Documentation

#define KTR_CRITICAL   0

Definition at line 52 of file kern_switch.c.

Referenced by critical_enter(), and critical_exit().

Function Documentation

__FBSDID ( "$BSDSUniX$"  )
struct thread* choosethread ( void  )

Definition at line 154 of file kern_switch.c.

References panicstr, and sched_choose().

Referenced by sched_switch(), and sched_throw().

Here is the call graph for this function:

Here is the caller graph for this function:

void critical_enter ( void  )

Definition at line 181 of file kern_switch.c.

References KTR_CRITICAL.

Referenced by _rm_rlock_hard(), configtimer(), get_thread_cputime(), intr_event_handle(), malloc_type_freed(), malloc_type_zone_allocated(), panic(), and rtp_to_pri().

Here is the caller graph for this function:

void critical_exit ( void  )

Definition at line 192 of file kern_switch.c.

References kdb_active, KTR_CRITICAL, and mi_switch().

Referenced by _rm_rlock_hard(), _rm_unlock_hard(), configtimer(), get_thread_cputime(), intr_event_handle(), malloc_type_freed(), malloc_type_zone_allocated(), panic(), and rtp_to_pri().

Here is the call graph for this function:

Here is the caller graph for this function:

CTASSERT ( (RQB_BPW *RQB_LEN)  = =RQ_NQS)
void runq_add ( struct runq rq,
struct thread *  td,
int  flags 
)

Definition at line 332 of file kern_switch.c.

References runq_setbit().

Referenced by sched_add(), and tdq_runq_add().

Here is the call graph for this function:

Here is the caller graph for this function:

void runq_add_pri ( struct runq rq,
struct thread *  td,
u_char  pri,
int  flags 
)

Definition at line 351 of file kern_switch.c.

References runq_setbit().

Referenced by tdq_runq_add().

Here is the call graph for this function:

Here is the caller graph for this function:

int runq_check ( struct runq rq)

Definition at line 373 of file kern_switch.c.

Referenced by sched_runnable().

Here is the caller graph for this function:

struct thread* runq_choose ( struct runq rq)

Definition at line 436 of file kern_switch.c.

References runq_findbit().

Referenced by sched_choose(), and tdq_choose().

Here is the call graph for this function:

Here is the caller graph for this function:

struct thread* runq_choose_from ( struct runq rq,
u_char  idx 
)

Definition at line 456 of file kern_switch.c.

References runq_findbit_from().

Referenced by tdq_choose().

Here is the call graph for this function:

Here is the caller graph for this function:

struct thread* runq_choose_fuzz ( struct runq rq,
int  fuzz 
)

Definition at line 394 of file kern_switch.c.

References count, and runq_findbit().

Referenced by sched_choose().

Here is the call graph for this function:

Here is the caller graph for this function:

static __inline void runq_clrbit ( struct runq rq,
int  pri 
)
static

Definition at line 243 of file kern_switch.c.

Referenced by runq_remove_idx().

Here is the caller graph for this function:

static __inline int runq_findbit ( struct runq rq)
static

Definition at line 260 of file kern_switch.c.

Referenced by runq_choose(), and runq_choose_fuzz().

Here is the caller graph for this function:

static __inline int runq_findbit_from ( struct runq rq,
u_char  pri 
)
static

Definition at line 279 of file kern_switch.c.

References mask.

Referenced by runq_choose_from().

Here is the caller graph for this function:

void runq_init ( struct runq rq)

Definition at line 229 of file kern_switch.c.

Referenced by setup_runqs(), and tdq_setup().

Here is the caller graph for this function:

void runq_remove ( struct runq rq,
struct thread *  td 
)

Definition at line 481 of file kern_switch.c.

References runq_remove_idx().

Referenced by sched_choose(), sched_rem(), and tdq_runq_rem().

Here is the call graph for this function:

Here is the caller graph for this function:

void runq_remove_idx ( struct runq rq,
struct thread *  td,
u_char *  idx 
)

Definition at line 488 of file kern_switch.c.

References runq_clrbit().

Referenced by runq_remove(), and tdq_runq_rem().

Here is the call graph for this function:

Here is the caller graph for this function:

static __inline void runq_setbit ( struct runq rq,
int  pri 
)
static

Definition at line 315 of file kern_switch.c.

Referenced by runq_add(), and runq_add_pri().

Here is the caller graph for this function:

SYSCTL_INT ( _kern_sched  ,
OID_AUTO  ,
preemption  ,
CTLFLAG_RD  ,
kern_sched_preemption,
,
"Kernel preemption enabled"   
)

Variable Documentation

int kern_sched_preemption = 0
static

Definition at line 71 of file kern_switch.c.