linux 2614内核调度文件schedh.docx
- 文档编号:23608359
- 上传时间:2023-05-19
- 格式:DOCX
- 页数:48
- 大小:31.90KB
linux 2614内核调度文件schedh.docx
《linux 2614内核调度文件schedh.docx》由会员分享,可在线阅读,更多相关《linux 2614内核调度文件schedh.docx(48页珍藏版)》请在冰豆网上搜索。
linux2614内核调度文件schedh
///////include/sched.h
#ifndef_LINUX_SCHED_H
#define_LINUX_SCHED_H
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
structexec_domain;
/*
*cloningflags:
*/
#defineCSIGNAL0x000000ff/*signalmasktobesentatexit*/
#defineCLONE_VM0x00000100/*setifVMsharedbetweenprocesses*/
#defineCLONE_FS0x00000200/*setiffsinfosharedbetweenprocesses*/
#defineCLONE_FILES0x00000400/*setifopenfilessharedbetweenprocesses*/
#defineCLONE_SIGHAND0x00000800/*setifsignalhandlersandblockedsignalsshared*/
#defineCLONE_PTRACE0x00002000/*setifwewanttolettracingcontinueonthechildtoo*/
#defineCLONE_VFORK0x00004000/*setiftheparentwantsthechildtowakeituponmm_release*/
#defineCLONE_PARENT0x00008000/*setifwewanttohavethesameparentasthecloner*/
#defineCLONE_THREAD0x00010000/*Samethreadgroup?
*/
#defineCLONE_NEWNS0x00020000/*Newnamespacegroup?
*/
#defineCLONE_SYSVSEM0x00040000/*sharesystemVSEM_UNDOsemantics*/
#defineCLONE_SETTLS0x00080000/*createanewTLSforthechild*/
#defineCLONE_PARENT_SETTID0x00100000/*settheTIDintheparent*/
#defineCLONE_CHILD_CLEARTID0x00200000/*cleartheTIDinthechild*/
#defineCLONE_DETACHED0x00400000/*Unused,ignored*/
#defineCLONE_UNTRACED0x00800000/*setifthetracingprocesscan'tforceCLONE_PTRACEonthisclone*/
#defineCLONE_CHILD_SETTID0x01000000/*settheTIDinthechild*/
#defineCLONE_STOPPED0x02000000/*Startinstoppedstate*/
/*
*Listofflagswewanttoshareforkernelthreads,
*ifonlybecausetheyarenotusedbythemanyway.
*/
#defineCLONE_KERNEL(CLONE_FS|CLONE_FILES|CLONE_SIGHAND)
/*
*Thesearetheconstantusedtofakethefixed-pointload-average
*counting.Somenotes:
*-11bitfractionsexpandto22bitsbythemultiplies:
thisgives
*aload-averageprecisionof10bitsinteger+11bitsfractional
*-ifyouwanttocountload-averagesmoreoften,youneedmore
*precision,orroundingwillgetyou.With2-secondcountingfreq,
*theEXP_nvalueswouldbe1981,2034and2043ifstillusingonly
*11bitfractions.
*/
externunsignedlongavenrun[];/*Loadaverages*/
#defineFSHIFT11/*nrofbitsofprecision*/
#defineFIXED_1(1< #defineLOAD_FREQ(5*HZ)/*5secintervals*/ #defineEXP_11884/*1/exp(5sec/1min)asfixed-point*/ #defineEXP_52014/*1/exp(5sec/5min)*/ #defineEXP_152037/*1/exp(5sec/15min)*/ #defineCALC_LOAD(load,exp,n)\ load*=exp;\ load+=n*(FIXED_1-exp);\ load>>=FSHIFT; externunsignedlongtotal_forks; externintnr_threads; externintlast_pid; DECLARE_PER_CPU(unsignedlong,process_counts); externintnr_processes(void); externunsignedlongnr_running(void); externunsignedlongnr_uninterruptible(void); externunsignedlongnr_iowait(void); #include #include #include #include #include /* *Taskstatebitmask.NOTE! Thesebitsarealso *encodedinfs/proc/array.c: get_task_state(). * *Wehavetwoseparatesetsofflags: task->state *isaboutrunnability,whiletask->exit_stateare *aboutthetaskexiting.Confusing,butthisway *modifyingonesetcan'tmodifytheotheroneby *mistake. */ #defineTASK_RUNNING0 #defineTASK_INTERRUPTIBLE1 #defineTASK_UNINTERRUPTIBLE2 #defineTASK_STOPPED4 #defineTASK_TRACED8 /*intsk->exit_state*/ #defineEXIT_ZOMBIE16 #defineEXIT_DEAD32 /*intsk->stateagain*/ #defineTASK_NONINTERACTIVE64 #define__set_task_state(tsk,state_value)\ do{(tsk)->state=(state_value);}while(0) #defineset_task_state(tsk,state_value)\ set_mb((tsk)->state,(state_value)) /* *set_current_state()includesabarriersothatthewriteofcurrent->state *iscorrectlyserialisedwrtthecaller'ssubsequenttestofwhetherto *actuallysleep: * *set_current_state(TASK_UNINTERRUPTIBLE); *if(do_i_need_to_sleep()) *schedule(); * *Ifthecallerdoesnotneedsuchserialisationthenuse__set_current_state() */ #define__set_current_state(state_value)\ do{current->state=(state_value);}while(0) #defineset_current_state(state_value)\ set_mb(current->state,(state_value)) /*Taskcommandnamelength*/ #defineTASK_COMM_LEN16 /* *Schedulingpolicies */ #defineSCHED_NORMAL0 #defineSCHED_FIFO1 #defineSCHED_RR2 structsched_param{ intsched_priority; }; #ifdef__KERNEL__ #include /* *Thisserializes"schedule()"andalsoprotects *therun-queuefromdeletions/modifications(but *_adding_tothebeginningoftherun-queuehas *aseparatelock). */ externrwlock_ttasklist_lock; externspinlock_tmmlist_lock; typedefstructtask_structtask_t; externvoidsched_init(void); externvoidsched_init_smp(void); externvoidinit_idle(task_t*idle,intcpu); externcpumask_tnohz_cpu_mask; externvoidshow_state(void); externvoidshow_regs(structpt_regs*); /* *TASKisapointertothetaskwhosebacktracewewanttosee(orNULLforcurrent *task),SPisthestackpointerofthefirstframethatshouldbeshownintheback *trace(orNULLiftheentirecall-chainofthetaskshouldbeshown). */ externvoidshow_stack(structtask_struct*task,unsignedlong*sp); voidio_schedule(void); longio_schedule_timeout(longtimeout); externvoidcpu_init(void); externvoidtrap_init(void); externvoidupdate_process_times(intuser); externvoidscheduler_tick(void); #ifdefCONFIG_DETECT_SOFTLOCKUP externvoidsoftlockup_tick(structpt_regs*regs); externvoidspawn_softlockup_task(void); externvoidtouch_softlockup_watchdog(void); #else staticinlinevoidsoftlockup_tick(structpt_regs*regs) { } staticinlinevoidspawn_softlockup_task(void) { } staticinlinevoidtouch_softlockup_watchdog(void) { } #endif /*Attachtoanyfunctionswhichshouldbeignoredinwchanoutput.*/ #define__sched__attribute__((__section__(".sched.text"))) /*Isthisaddressinthe__schedfunctions? */ externintin_sched_functions(unsignedlongaddr); #defineMAX_SCHEDULE_TIMEOUTLONG_MAX externsignedlongFASTCALL(schedule_timeout(signedlongtimeout)); externsignedlongschedule_timeout_interruptible(signedlongtimeout); externsignedlongschedule_timeout_uninterruptible(signedlongtimeout); asmlinkagevoidschedule(void); structnamespace; /*Maximumnumberofactivemapareas..Thisisarandom(large)number*/ #defineDEFAULT_MAX_MAP_COUNT65536 externintsysctl_max_map_count; #include externunsignedlong arch_get_unmapped_area(structfile*,unsignedlong,unsignedlong, unsignedlong,unsignedlong); externunsignedlong arch_get_unmapped_area_topdown(structfile*filp,unsignedlongaddr, unsignedlonglen,unsignedlongpgoff, unsignedlongflags); externvoidarch_unmap_area(structmm_struct*,unsignedlong); externvoidarch_unmap_area_topdown(structmm_struct*,unsignedlong); #defineset_mm_counter(mm,member,value)(mm)->_##member=(value) #defineget_mm_counter(mm,member)((mm)->_##member) #defineadd_mm_counter(mm,member,value)(mm)->_##member+=(value) #defineinc_mm_counter(mm,member)(mm)->_##member++ #definedec_mm_counter(mm,member)(mm)->_##member-- typedefunsignedlongmm_counter_t; structmm_struct{ structvm_area_struct*mmap;/*listofVMAs*/ structrb_rootmm_rb; structvm_area_struct*mmap_cache;/*lastfind_vmaresult*/ unsignedlong(*get_unmapped_area)(structfile*filp, unsignedlongaddr,unsignedlonglen, unsignedlongpgoff,unsignedlongflags); void(*unmap_area)(structmm_struct*mm,unsignedlongaddr); unsignedlongmmap_base;/*baseofmmaparea*/ unsignedlongcached_hole_size;/*ifnon-zero,thelargestholebelowfree_area_cache*/ unsignedlongfree_area_cache;/*firstholeofsizecached_hole_sizeorlarger*/ pgd_t*pgd; atomic_tmm_users;/*Howmanyuserswithuserspace? */ atomic_tmm_count;/*Howmanyreferencesto"structmm_struct"(userscountas1)*/ intmap_count;/*numberofVMAs*/ structrw_semaphoremmap_sem; spinlock_tpage_table_lock;/*Protectspagetablesandsomecounters*/ structlist_headmmlist;/*Listofmaybeswappedmm's.Thesearegloballystrung *togetheroffinit_mm.mmlist,andareprotected *bymmlist_lock */ unsignedlongstart_code,end_code,start_data,end_data; unsignedlongstart_brk,brk,start_stack; unsignedlongarg_start,arg_end,env_start,env_end; unsignedlongtotal_vm,locked_vm,shared_vm; unsignedlongexec_vm,stack_vm,reserved_vm,def_flags,nr_ptes; /*Specialcountersprotectedbythepage_table_lock*/ mm_counter_t_rss; mm_counter_t_anon_rss; unsignedlongsaved_auxv[AT_VECTOR_SIZE];/*for/proc/PID/auxv*/ unsigneddumpable: 2; cpumask_tcpu_vm_mask; /*
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- linux 2614内核调度文件schedh 2614 内核 调度 文件 schedh