Ядро Linux в комментариях




Kernel/sched.c


26041 /* 26042 * linux/kernel/sched.c 26043 * 26044 * Copyright (C) 1991, 1992 Linus Torvalds 26045 * 26046 * 1996-12-23 Modified by Dave Grothe to fix bugs in 26047 * semaphores and make semaphores SMP safe 26048 * 1997-01-28 Modified by Finn Arne Gangstad to make 26049 * timers scale better. 26050 * 1997-09-10 Updated NTP code according to technical 26051 * memorandum Jan '96 "A Kernel Model for Precision 26052 * Timekeeping" by Dave Mills 26053 * 1998-11-19 Implemented schedule_timeout() and related 26054 * stuff by Andrea Arcangeli 26055 * 1998-12-24 Fixed a xtime SMP race (we need the 26056 * xtime_lock rw spinlock to serialize accesses to 26057 * xtime/lost_ticks). Copyright (C) 1998 Andrea 26058 * Arcangeli 26059 * 1998-12-28 Implemented better SMP scheduling by Ingo 26060 * Molnar 26061 * 1999-03-10 Improved NTP compatibility by Ulrich Windl 26062 */ 26063 26064 /* 'sched.c' is the main kernel file. It contains 26065 * scheduling primitives (sleep_on, wakeup, schedule etc) 26066 * as well as a number of simple system call functions 26067 * (type getpid()), which just extract a field from 26068 * current-task */ 26069 26070 #include <linux/mm.h> 26071 #include <linux/kernel_stat.h> 26072 #include <linux/fdreg.h> 26073 #include <linux/delay.h> 26074 #include <linux/interrupt.h> 26075 #include <linux/smp_lock.h> 26076 #include <linux/init.h> 26077 26078 #include <asm/io.h> 26079 #include <asm/uaccess.h> 26080 #include <asm/pgtable.h> 26081 #include <asm/mmu_context.h> 26082 #include <asm/semaphore-helper.h> 26083 26084 #include <linux/timex.h> 26085 26086 /* kernel variables */ 26087 26088 /* systemwide security settings */ 26089 unsigned securebits = SECUREBITS_DEFAULT; 26090 26091 /* timer interrupt period */ 26092 long tick = (1000000 + HZ/2) / HZ; 26093 26094 /* The current time */ 26095 volatile struct timeval 26096 xtime __attribute__ ((aligned (16))); 26097 26098 /* Don't completely fail for HZ > 500. */ 26099 int tickadj = 500/HZ ? : 1; /* microsecs */ 26100 26101 DECLARE_TASK_QUEUE(tq_timer); 26102 DECLARE_TASK_QUEUE(tq_immediate); 26103 DECLARE_TASK_QUEUE(tq_scheduler); 26104 26105 /* phase-lock loop variables */ 26106 /* TIME_ERROR prevents overwriting the CMOS clock */ 26107 /* clock synchronization status */ 26108 int time_state = TIME_OK; 26109 /* clock status bits */ 26110 int time_status = STA_UNSYNC; 26111 /* time adjustment (us) */ 26112 long time_offset = 0; 26113 /* pll time constant */ 26114 long time_constant = 2; 26115 /* frequency tolerance (ppm) */ 26116 long time_tolerance = MAXFREQ; 26117 /* clock precision (us) */ 26118 long time_precision = 1; 26119 /* maximum error (us) */ 26120 long time_maxerror = NTP_PHASE_LIMIT; 26121 /* estimated error (us) */ 26122 long time_esterror = NTP_PHASE_LIMIT; 26123 /* phase offset (scaled us) */ 26124 long time_phase = 0; 26125 /* frequency offset (scaled ppm) */ 26126 long time_freq = 26127 ((1000000 + HZ/2) % HZ - HZ/2) << SHIFT_USEC; 26128 /* tick adjust (scaled 1 / HZ) */ 26129 long time_adj = 0; 26130 /* time at last adjustment (s) */ 26131 long time_reftime = 0; 26132 26133 long time_adjust = 0; 26134 long time_adjust_step = 0; 26135 26136 unsigned long event = 0; 26137 26138 extern int do_setitimer(int, struct itimerval *, 26139 struct itimerval *); 26140 unsigned int * prof_buffer = NULL; 26141 unsigned long prof_len = 0; 26142 unsigned long prof_shift = 0; 26143 26144 extern void mem_use(void); 26145 26146 unsigned long volatile jiffies=0; 26147 26148 /* Init task must be ok at boot for the ix86 as we will 26149 * check its signals via the SMP irq return path. */ 26150 struct task_struct * task[NR_TASKS] = {&init_task, }; 26151 26152 struct kernel_stat kstat = { 0 }; 26153 26154 void scheduling_functions_start_here(void) { } 26155 26156 #ifdef __SMP__




Содержание  Назад  Вперед