#include <system_data_cells.h>
#include <dyndef.h>
#include <phddef.h>
#include <linux/config.h>
#include <linux/mm.h>
#include <linux/init.h>
#include <linux/smp_lock.h>
#include <linux/nmi.h>
#include <linux/interrupt.h>
#include <linux/kernel_stat.h>
#include <linux/completion.h>
#include <linux/prefetch.h>
#include <linux/compiler.h>
#include <asm/uaccess.h>
#include <asm/mmu_context.h>
#include <sysgen.h>
#include <ipldef.h>
#include <ipl.h>
#include <statedef.h>
#include <queue.h>
#include <system_service_setup.h>
#include <internals.h>
#include <exe_routines.h>
#include <sch_routines.h>
#include <misc_routines.h>
#include <cpbdef.h>
#include <rsndef.h>
Go to the source code of this file.
Defines | |
#define | DEBUG_SCHED |
#define | TICK_SCALE(x) ((x) >> 2) |
#define | NICE_TO_TICKS(nice) (TICK_SCALE(20-(nice))+1) |
#define | idle_task(cpu) (&init_task) |
#define | can_schedule(p, cpu) (1) |
#define | SLEEP_ON_VAR |
#define | SLEEP_ON_HEAD |
#define | SLEEP_ON_TAIL |
Functions | |
void | timer_bh (void) |
void | tqueue_bh (void) |
void | immediate_bh (void) |
void | mem_use (void) |
mycheckaddr (unsigned int ctl) | |
check content ok | |
int | numproc (void) |
void | printcom (void) |
void | printcom2 (void) |
void | scheduling_functions_start_here (void) |
int | task_on_comqueue (struct _pcb *p) |
is the task on comqueue? | |
int fastcall | wake_up_process (struct task_struct *p) |
signed long fastcall | schedule_timeout (signed long timeout) |
asmlinkage void | sch_sched (int) |
asmlinkage void | sch_resched (void) |
rescheduling - see 5.2 12.6.4 | |
asmlinkage void | schedule (void) |
asmlinkage void | sch_sched (int from_sch $resched) |
void fastcall | __wake_up (wait_queue_head_t *q, unsigned int mode, int nr) |
void fastcall | __wake_up_sync (wait_queue_head_t *q, unsigned int mode, int nr) |
void fastcall | complete (struct completion *x) |
void fastcall | wait_for_completion (struct completion *x) |
void fastcall | interruptible_sleep_on (wait_queue_head_t *q) |
long fastcall | interruptible_sleep_on_timeout (wait_queue_head_t *q, long timeout) |
void fastcall | sleep_on (wait_queue_head_t *q) |
long fastcall | sleep_on_timeout (wait_queue_head_t *q, long timeout) |
void | scheduling_functions_end_here (void) |
asmlinkage long | sys_nice (int increment) |
struct task_struct * | find_process_by_pid (pid_t pid) |
asmlinkage long | sys_sched_setscheduler (pid_t pid, int policy, struct sched_param *param) |
asmlinkage long | sys_sched_setparam (pid_t pid, struct sched_param *param) |
asmlinkage long | sys_sched_getscheduler (pid_t pid) |
asmlinkage long | sys_sched_getparam (pid_t pid, struct sched_param *param) |
asmlinkage long | sys_sched_yield (void) |
asmlinkage long | sys_sched_get_priority_max (int policy) |
asmlinkage long | sys_sched_get_priority_min (int policy) |
asmlinkage long | sys_sched_rr_get_interval (pid_t pid, struct timespec *interval) |
char * | render_sigset_t (sigset_t *set, char *buffer) |
void | show_state (void) |
void | reparent_to_init (void) |
void | daemonize (void) |
void __init | init_idle (void) |
void | init_timervecs (void) |
void __init | sched_init (void) |
Variables | |
int | done_init_idle = 0 |
unsigned | securebits = SECUREBITS_DEFAULT |
int | mydebug4 = 0 |
int | mydebug5 = 0 |
int | mydebug6 = 1 |
struct task_struct * | init_tasks [NR_CPUS] = {&init_task, } |
spinlock_t runqueue_lock | __cacheline_aligned = SPIN_LOCK_UNLOCKED |
struct kernel_stat | kstat |
struct task_struct * | child_reaper |
int | fix_init_thread |
int | countme = 500 |
int | mydebug = 0 |
int | mydebug2 = 0 |
int | mycount = 0 |
unsigned long | wait_init_idle |
struct _phd | system_phd |
unsigned long | pcbvec [] |
unsigned long | seqvec [] |
Definition in file sched.c.
#define idle_task | ( | cpu | ) | (&init_task) |
Definition at line 294 of file sched.c.
Referenced by sch_resched(), sch_sched(), and sys_sched_yield().
#define NICE_TO_TICKS | ( | nice | ) | (TICK_SCALE(20-(nice))+1) |
#define SLEEP_ON_HEAD |
Value:
wq_write_lock_irqsave(&q->lock,flags); \ __add_wait_queue(q, &wait); \ wq_write_unlock(&q->lock);
Definition at line 1241 of file sched.c.
Referenced by interruptible_sleep_on(), interruptible_sleep_on_timeout(), sleep_on(), and sleep_on_timeout().
#define SLEEP_ON_TAIL |
Value:
wq_write_lock_irq(&q->lock); \ __remove_wait_queue(q, &wait); \ wq_write_unlock_irqrestore(&q->lock,flags);
Definition at line 1246 of file sched.c.
Referenced by interruptible_sleep_on(), interruptible_sleep_on_timeout(), sleep_on(), and sleep_on_timeout().
#define SLEEP_ON_VAR |
Value:
unsigned long flags; \ wait_queue_t wait; \ init_waitqueue_entry(&wait, current);
Definition at line 1236 of file sched.c.
Referenced by interruptible_sleep_on(), interruptible_sleep_on_timeout(), sleep_on(), and sleep_on_timeout().
void fastcall __wake_up | ( | wait_queue_head_t * | q, | |
unsigned int | mode, | |||
int | nr | |||
) |
void fastcall __wake_up_sync | ( | wait_queue_head_t * | q, | |
unsigned int | mode, | |||
int | nr | |||
) |
struct task_struct* find_process_by_pid | ( | pid_t | pid | ) | [read] |
Definition at line 1342 of file sched.c.
References find_task_by_pid().
Referenced by exe_epid_to_ipid(), exe_ipid_to_pcb(), sys_sched_getparam(), sys_sched_getscheduler(), and sys_sched_rr_get_interval().
void immediate_bh | ( | void | ) |
Referenced by sched_init().
void __init init_idle | ( | void | ) |
Definition at line 1773 of file sched.c.
References _pcb, done_init_idle, smp_gl_cpu_data, and system_phd.
void init_timervecs | ( | void | ) |
Referenced by sched_init().
void fastcall interruptible_sleep_on | ( | wait_queue_head_t * | q | ) |
Definition at line 1251 of file sched.c.
References schedule(), SLEEP_ON_HEAD, SLEEP_ON_TAIL, and SLEEP_ON_VAR.
long fastcall interruptible_sleep_on_timeout | ( | wait_queue_head_t * | q, | |
long | timeout | |||
) |
Definition at line 1263 of file sched.c.
References schedule_timeout(), SLEEP_ON_HEAD, SLEEP_ON_TAIL, and SLEEP_ON_VAR.
void mem_use | ( | void | ) |
mycheckaddr | ( | unsigned int | ctl | ) |
check content ok
Definition at line 102 of file sched.c.
References _pcb, ctl_gl_pcb, sch_aq_comh, sch_aq_comt, and sch_gl_comqs.
Referenced by sch_chsep(), sch_chsep2(), sch_resched(), sch_rse(), and sch_sched().
int numproc | ( | void | ) |
Definition at line 172 of file sched.c.
References _pcb, and sch_aq_comh.
Referenced by sch_resched(), and sch_sched().
void printcom | ( | void | ) |
Definition at line 192 of file sched.c.
References _pcb, sch_aq_comh, and sch_gl_comqs.
Referenced by sch_resched(), and sch_sched().
void printcom2 | ( | void | ) |
Definition at line 212 of file sched.c.
References _pcb, sch_aq_comh, sch_aq_comt, and sch_gl_comqs.
void reparent_to_init | ( | void | ) |
reparent_to_init() - Reparent the calling kernel thread to the init task.
If a kernel thread is launched as a result of a system call, or if it ever exits, it should generally reparent itself to init so that it is correctly cleaned up on exit.
The various task state such as scheduling policy and priority may have been inherited fro a user process, so we reset them to sane values here.
NOTE that reparent_to_init() gives the caller full capabilities.
Definition at line 1701 of file sched.c.
References child_reaper, and DEFPRI.
asmlinkage void sch_resched | ( | void | ) |
rescheduling - see 5.2 12.6.4
spinlock sched and set ipl
get current pcb and priority
clear bit in cpu_priority table
if no process with this pri on any cpu, clear bit in active_priority table
now some if's remaining from linux - TODO: check if still needed
set pri bit in comqs
set state of cur pcb to COM
insert pcb at tail of comqueue
linux leftover
clear idle_cpus to signal all idle cpus to try to reschedule
go some intro sch_sched
Definition at line 622 of file sched.c.
References _pcb, _cpu::cpu_b_cur_pri, _cpu::cpu_l_curpcb, idle_task, IPL__RESCHED, IPL__SCHED, mycheckaddr(), numproc(), printcom(), sch_al_cpu_priority, sch_aq_comh, sch_aq_comt, sch_gl_active_priority, sch_gl_comqs, sch_gl_idle_cpus, sch_sched(), smp_gl_cpu_data, SPIN_SCHED, and task_on_comqueue().
asmlinkage void sch_sched | ( | int from_sch $ | resched | ) |
clear cpu_priority for current pri bit - TODO: where did this come from?
skip if ... TODO: from where?
clear active_priority for current pri bit - TODO: where did this come from?
now 4 linux leftovers
reset cpu affinity TODO: from where?
find highest pri comqueue
if none found, idle
set bit in idle_cpus
store null pcb and -1 pri: MISSING check why
necessary idle_task line from linux
if pcb in queue
get new pcb from selected comqueue
zero next pcb queue header TODO: check if still needed
linux pcb count leftover
if last in queue clear comqs bit
test process capabilities
if the capabilities match, store new pcb in per-cpu db
change new pcb to CUR state
store cpu id in pcb
modify new pcb pri
copy new pri in cpu pri db
clear idle_cpus mask TODO: check setting cpuid_mask
set bit it cpu_priority table to cpuid_mask
set bit in active_priority
this if is a linux leftover
sets pcb cpu_id again TODO: not needed?
spinunlock
linux count line
from here, prepare_to_switch() and switch_to() are from linux, due to missing LDPCTX and SVPCTX etc
need to set astlvl
Definition at line 765 of file sched.c.
References _pcb, _cpu::cpu_b_cur_pri, _cpu::cpu_b_ipl, _cpu::cpu_l_curpcb, idle_task, IPL__RESCHED, IPL__SCHED, kstat, mycheckaddr(), mydebug4, mydebug5, mydebug6, numproc(), printcom(), qhead_init(), sch_al_cpu_priority, sch_aq_comh, sch_gl_active_priority, sch_gl_capability_sequence, sch_gl_comqs, sch_gl_idle_cpus, sch_gl_resmask, sch_gq_mwait, smp_gl_cpu_data, SPIN_SCHED, and _spl::spl_l_spinlock.
asmlinkage void sch_sched | ( | int | ) |
void __init sched_init | ( | void | ) |
Definition at line 1800 of file sched.c.
References _cpu::cpu_b_cur_pri, _cpu::cpu_l_curpcb, immediate_bh(), init_timervecs(), MAXPROCESSCNT, qhead_init(), sch_gl_pcbvec, sch_gl_seqvec, smp_gl_cpu_data, timer_bh(), and tqueue_bh().
asmlinkage void schedule | ( | void | ) |
Definition at line 759 of file sched.c.
Referenced by __wait_on_buffer(), interruptible_sleep_on(), schedule_timeout(), sleep_on(), and wait_for_completion().
signed long fastcall schedule_timeout | ( | signed long | timeout | ) |
schedule_timeout - sleep until timeout : timeout value in jiffies
Make the current task sleep until jiffies have elapsed. The routine will return immediately unless the current task state has been set (see set_current_state()).
You can set the task state as follows -
TASK_UNINTERRUPTIBLE - at least jiffies are guaranteed to pass before the routine returns. The routine will return 0
TASK_INTERRUPTIBLE - the routine may return early if a signal is delivered to the current task. In this case the remaining time in jiffies will be returned, or 0 if the timer expired in time
The current task state is guaranteed to be TASK_RUNNING when this routine returns.
Specifying a value of MAX_SCHEDULE_TIMEOUT will schedule the CPU away without a bound on the timeout. In this case the return value will be MAX_SCHEDULE_TIMEOUT.
In all cases the return value is guaranteed to be non-negative.
Definition at line 556 of file sched.c.
References schedule().
Referenced by interruptible_sleep_on_timeout(), and sleep_on_timeout().
void fastcall sleep_on | ( | wait_queue_head_t * | q | ) |
Definition at line 1277 of file sched.c.
References schedule(), SLEEP_ON_HEAD, SLEEP_ON_TAIL, and SLEEP_ON_VAR.
long fastcall sleep_on_timeout | ( | wait_queue_head_t * | q, | |
long | timeout | |||
) |
Definition at line 1289 of file sched.c.
References schedule_timeout(), SLEEP_ON_HEAD, SLEEP_ON_TAIL, and SLEEP_ON_VAR.
asmlinkage long sys_sched_get_priority_max | ( | int | policy | ) |
Definition at line 1545 of file sched.c.
References PCB_K_SCHED_FIFO, PCB_K_SCHED_OTHER, and PCB_K_SCHED_RR.
asmlinkage long sys_sched_get_priority_min | ( | int | policy | ) |
Definition at line 1561 of file sched.c.
References PCB_K_SCHED_FIFO, PCB_K_SCHED_OTHER, and PCB_K_SCHED_RR.
asmlinkage long sys_sched_getparam | ( | pid_t | pid, | |
struct sched_param * | param | |||
) |
asmlinkage long sys_sched_getscheduler | ( | pid_t | pid | ) |
asmlinkage long sys_sched_rr_get_interval | ( | pid_t | pid, | |
struct timespec * | interval | |||
) |
Definition at line 1576 of file sched.c.
References exe_epid_to_ipid(), find_process_by_pid(), and NICE_TO_TICKS.
asmlinkage long sys_sched_setparam | ( | pid_t | pid, | |
struct sched_param * | param | |||
) |
asmlinkage long sys_sched_setscheduler | ( | pid_t | pid, | |
int | policy, | |||
struct sched_param * | param | |||
) |
asmlinkage long sys_sched_yield | ( | void | ) |
int task_on_comqueue | ( | struct _pcb * | p | ) |
is the task on comqueue?
Definition at line 405 of file sched.c.
References _pcb, and sch_aq_comh.
Referenced by sch_chsep(), sch_resched(), and sch_waitk().
void timer_bh | ( | void | ) |
Referenced by sched_init().
void tqueue_bh | ( | void | ) |
Referenced by sched_init().
void fastcall wait_for_completion | ( | struct completion * | x | ) |
int fastcall wake_up_process | ( | struct task_struct * | p | ) | [inline] |
struct _spl SPIN_IOPOST __cacheline_aligned = SPIN_LOCK_UNLOCKED [read] |
struct task_struct* child_reaper |
Referenced by reparent_to_init().
int done_init_idle = 0 |
int fix_init_thread |
struct task_struct* init_tasks[NR_CPUS] = {&init_task, } |
struct kernel_stat kstat |
Definition at line 283 of file sched.c.
Referenced by sch_sched(), vms_do_IRQ(), and vms_get_irq_list().
int mydebug4 = 0 |
int mydebug5 = 0 |
int mydebug6 = 1 |
unsigned long pcbvec[] |
Definition at line 2019 of file system_data_cells.c.
unsigned securebits = SECUREBITS_DEFAULT |
unsigned long seqvec[] |
Definition at line 2020 of file system_data_cells.c.
struct _phd system_phd |
unsigned long wait_init_idle |