Changeset View
Changeset View
Standalone View
Standalone View
sys/sys/sched.h
| Show First 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | |||||
| #define _SCHED_H_ | #define _SCHED_H_ | ||||
| #ifdef _KERNEL | #ifdef _KERNEL | ||||
| #include <sys/types.h> | #include <sys/types.h> | ||||
| #ifdef SCHED_STATS | #ifdef SCHED_STATS | ||||
| #include <sys/pcpu.h> | #include <sys/pcpu.h> | ||||
| #endif | #endif | ||||
| #include <sys/linker_set.h> | |||||
| struct proc; | struct proc; | ||||
| struct thread; | struct thread; | ||||
| /* | /* | ||||
| * General scheduling info. | * General scheduling info. | ||||
| * | * | ||||
| * sched_load: | * sched_load: | ||||
| Show All 30 Lines | |||||
| fixpt_t sched_pctcpu(struct thread *td); | fixpt_t sched_pctcpu(struct thread *td); | ||||
| void sched_prio(struct thread *td, u_char prio); | void sched_prio(struct thread *td, u_char prio); | ||||
| void sched_sleep(struct thread *td, int prio); | void sched_sleep(struct thread *td, int prio); | ||||
| void sched_switch(struct thread *td, int flags); | void sched_switch(struct thread *td, int flags); | ||||
| void sched_throw(struct thread *td); | void sched_throw(struct thread *td); | ||||
| void sched_unlend_prio(struct thread *td, u_char prio); | void sched_unlend_prio(struct thread *td, u_char prio); | ||||
| void sched_user_prio(struct thread *td, u_char prio); | void sched_user_prio(struct thread *td, u_char prio); | ||||
| void sched_userret_slowpath(struct thread *td); | void sched_userret_slowpath(struct thread *td); | ||||
| #ifdef RACCT | |||||
| #ifdef SCHED_4BSD | |||||
| fixpt_t sched_pctcpu_delta(struct thread *td); | fixpt_t sched_pctcpu_delta(struct thread *td); | ||||
| #endif | |||||
| #endif | |||||
| static inline void | static inline void | ||||
| sched_userret(struct thread *td) | sched_userret(struct thread *td) | ||||
| { | { | ||||
| /* | /* | ||||
| * XXX we cheat slightly on the locking here to avoid locking in | * XXX we cheat slightly on the locking here to avoid locking in | ||||
| * the usual case. Setting td_priority here is essentially an | * the usual case. Setting td_priority here is essentially an | ||||
| Show All 39 Lines | |||||
| int sched_sizeof_proc(void); | int sched_sizeof_proc(void); | ||||
| int sched_sizeof_thread(void); | int sched_sizeof_thread(void); | ||||
| /* | /* | ||||
| * This routine provides a consistent thread name for use with KTR graphing | * This routine provides a consistent thread name for use with KTR graphing | ||||
| * functions. | * functions. | ||||
| */ | */ | ||||
| char *sched_tdname(struct thread *td); | char *sched_tdname(struct thread *td); | ||||
| #ifdef KTR | |||||
| void sched_clear_tdname(struct thread *td); | void sched_clear_tdname(struct thread *td); | ||||
| #endif | |||||
| static __inline void | static __inline void | ||||
| sched_pin(void) | sched_pin(void) | ||||
| { | { | ||||
| curthread->td_pinned++; | curthread->td_pinned++; | ||||
| atomic_interrupt_fence(); | atomic_interrupt_fence(); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | |||||
| * Fixup scheduler state for proc0 and thread0 | * Fixup scheduler state for proc0 and thread0 | ||||
| */ | */ | ||||
| void schedinit(void); | void schedinit(void); | ||||
| /* | /* | ||||
| * Fixup scheduler state for secondary APs | * Fixup scheduler state for secondary APs | ||||
| */ | */ | ||||
| void schedinit_ap(void); | void schedinit_ap(void); | ||||
| bool sched_do_timer_accounting(void); | |||||
| /* | |||||
| * Find an L2 neighbor of the given CPU or return -1 if none found. This | |||||
| * does not distinguish among multiple L2 neighbors if the given CPU has | |||||
| * more than one (it will always return the same result in that case). | |||||
| */ | |||||
| int sched_find_l2_neighbor(int cpu); | |||||
| struct sched_instance { | |||||
| int (*load)(void); | |||||
| int (*rr_interval)(void); | |||||
| bool (*runnable)(void); | |||||
| void (*exit)(struct proc *p, struct thread *childtd); | |||||
| void (*fork)(struct thread *td, struct thread *childtd); | |||||
| void (*fork_exit)(struct thread *td); | |||||
| void (*class)(struct thread *td, int class); | |||||
| void (*nice)(struct proc *p, int nice); | |||||
| void (*ap_entry)(void); | |||||
| void (*exit_thread)(struct thread *td, struct thread *child); | |||||
| u_int (*estcpu)(struct thread *td); | |||||
| void (*fork_thread)(struct thread *td, struct thread *child); | |||||
| void (*ithread_prio)(struct thread *td, u_char prio); | |||||
| void (*lend_prio)(struct thread *td, u_char prio); | |||||
| void (*lend_user_prio)(struct thread *td, u_char pri); | |||||
| void (*lend_user_prio_cond)(struct thread *td, u_char pri); | |||||
| fixpt_t (*pctcpu)(struct thread *td); | |||||
| void (*prio)(struct thread *td, u_char prio); | |||||
| void (*sleep)(struct thread *td, int prio); | |||||
| void (*sswitch)(struct thread *td, int flags); | |||||
| void (*throw)(struct thread *td); | |||||
| void (*unlend_prio)(struct thread *td, u_char prio); | |||||
| void (*user_prio)(struct thread *td, u_char prio); | |||||
| void (*userret_slowpath)(struct thread *td); | |||||
| fixpt_t (*pctcpu_delta)(struct thread *td); | |||||
| void (*add)(struct thread *td, int flags); | |||||
| struct thread *(*choose)(void); | |||||
| void (*clock)(struct thread *td, int cnt); | |||||
| void (*idletd)(void *); | |||||
| void (*preempt)(struct thread *td); | |||||
| void (*relinquish)(struct thread *td); | |||||
| void (*rem)(struct thread *td); | |||||
| void (*wakeup)(struct thread *td, int srqflags); | |||||
| void (*bind)(struct thread *td, int cpu); | |||||
| void (*unbind)(struct thread *td); | |||||
| int (*is_bound)(struct thread *td); | |||||
| void (*affinity)(struct thread *td); | |||||
| int (*sizeof_proc)(void); | |||||
| int (*sizeof_thread)(void); | |||||
| char *(*tdname)(struct thread *td); | |||||
| void (*clear_tdname)(struct thread *td); | |||||
| bool (*do_timer_accounting)(void); | |||||
| int (*find_l2_neighbor)(int cpuid); | |||||
| void (*init)(void); | |||||
| void (*init_ap)(void); | |||||
| void (*setup)(void); | |||||
| void (*initticks)(void); | |||||
| void (*schedcpu)(void); | |||||
| }; | |||||
| extern const struct sched_instance *active_sched; | |||||
| struct sched_selection { | |||||
| const char *name; | |||||
| const struct sched_instance *instance; | |||||
| }; | |||||
| #define DECLARE_SCHEDULER(xsel_name, xsched_name, xsched_instance) \ | |||||
| static struct sched_selection xsel_name = { \ | |||||
| .name = xsched_name, \ | |||||
| .instance = xsched_instance, \ | |||||
| }; \ | |||||
| DATA_SET(sched_instance_set, xsel_name); | |||||
| void sched_instance_select(void); | |||||
| #endif /* _KERNEL */ | #endif /* _KERNEL */ | ||||
| /* POSIX 1003.1b Process Scheduling */ | /* POSIX 1003.1b Process Scheduling */ | ||||
| /* | /* | ||||
| * POSIX scheduling policies | * POSIX scheduling policies | ||||
| */ | */ | ||||
| #define SCHED_FIFO 1 | #define SCHED_FIFO 1 | ||||
| Show All 33 Lines | |||||