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 ("$FreeBSD$")
 
 CTASSERT ((RQB_BPW *RQB_LEN)==RQ_NQS)
 
 SYSCTL_INT (_kern_sched, OID_AUTO, preemption, CTLFLAG_RD, &kern_sched_preemption, 0, "Kernel preemption enabled")
 
static __noinline struct thread * choosethread_panic (struct thread *td)
 
struct thread * choosethread (void)
 
void critical_enter_KBI (void)
 
void __noinline critical_exit_preempt (void)
 
void critical_exit_KBI (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

◆ KTR_CRITICAL

#define KTR_CRITICAL   0

Definition at line 53 of file kern_switch.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ choosethread()

struct thread * choosethread ( void  )

Definition at line 180 of file kern_switch.c.

References choosethread_panic(), and sched_choose().

Referenced by sched_switch(), sched_throw_grab(), and sched_throw_tail().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ choosethread_panic()

static __noinline struct thread * choosethread_panic ( struct thread *  td)
static

Definition at line 159 of file kern_switch.c.

References sched_choose().

Referenced by choosethread().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ critical_enter_KBI()

void critical_enter_KBI ( void  )

Definition at line 204 of file kern_switch.c.

References KTR_CRITICAL.

◆ critical_exit_KBI()

void critical_exit_KBI ( void  )

Definition at line 249 of file kern_switch.c.

References KTR_CRITICAL.

◆ critical_exit_preempt()

void __noinline critical_exit_preempt ( void  )

Definition at line 215 of file kern_switch.c.

References flags, kdb_active, and mi_switch().

Here is the call graph for this function:

◆ CTASSERT()

CTASSERT ( (RQB_BPW *RQB_LEN)  = =RQ_NQS)

◆ runq_add()

void runq_add ( struct runq rq,
struct thread *  td,
int  flags 
)

Definition at line 369 of file kern_switch.c.

References flags, and 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:

◆ runq_add_pri()

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

Definition at line 388 of file kern_switch.c.

References flags, and runq_setbit().

Referenced by tdq_runq_add().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ runq_check()

int runq_check ( struct runq rq)

Definition at line 410 of file kern_switch.c.

Referenced by sched_runnable().

Here is the caller graph for this function:

◆ runq_choose()

struct thread * runq_choose ( struct runq rq)

Definition at line 473 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:

◆ runq_choose_from()

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

Definition at line 493 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:

◆ runq_choose_fuzz()

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

Definition at line 431 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:

◆ runq_clrbit()

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

Definition at line 280 of file kern_switch.c.

Referenced by runq_remove_idx().

Here is the caller graph for this function:

◆ runq_findbit()

static __inline int runq_findbit ( struct runq rq)
static

Definition at line 297 of file kern_switch.c.

Referenced by runq_choose(), and runq_choose_fuzz().

Here is the caller graph for this function:

◆ runq_findbit_from()

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

Definition at line 316 of file kern_switch.c.

References mask.

Referenced by runq_choose_from().

Here is the caller graph for this function:

◆ runq_init()

void runq_init ( struct runq rq)

Definition at line 266 of file kern_switch.c.

Referenced by setup_runqs(), and tdq_setup().

Here is the caller graph for this function:

◆ runq_remove()

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

Definition at line 518 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:

◆ runq_remove_idx()

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

Definition at line 525 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:

◆ runq_setbit()

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

Definition at line 352 of file kern_switch.c.

Referenced by runq_add(), and runq_add_pri().

Here is the caller graph for this function:

◆ SYSCTL_INT()

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

Variable Documentation

◆ kern_sched_preemption

int kern_sched_preemption = 0
static

Definition at line 72 of file kern_switch.c.