Function Report

Linux Kernel (v4.4)

Source File:kernel\sched\core.c Create Date:2016-01-14 10:40:44
Last Modify:2016-01-11 07:01:32 Copyright©Brick
home page Tree
Annotate the kernelChinese

Function Name:sched_fork

Function:int sched_fork(unsigned long clone_flags, struct task_struct *p)

Return Type:int

Parameter:

Type Parameter NameRemarks
unsigned long clone_flags
struct task_struct * p

Function description:fork()/clone()-time setup:

2190  cpu = get_cpu
2192  Perform scheduler related setup for a newly forked process p. p is forked by current.
2198  run state = Task state bitmask. NOTE! These bits are also encoded in fs/proc/array.c: get_task_state().
2203  prio = current process->normal_prio
2208  If Value for the false possibility is greater at compile time then
2212  rt_priority = 0
2213  Else if PRIO_TO_NICE < 0 then static_prio = Convert user-nice values[-20... 0... 19] to static priority[ MAX_RT_PRIO..MAX_PRIO-1], and back.
2216  prio = normal_prio = return the priority that is based on the static prio
2217  set_load_weight(p)
2223  scheduler bits, serialized by scheduler locks = 0
2226  If dl_prio(prio) then
2227  put_cpu
2228  Returning -Try again
2229  Else if rt_prio(prio) then
2230  sched_class = &rt_sched_class
2231  Else
2232  sched_class = &fair_sched_class
2235  If task_fork then task_fork
2245  raw_spin_lock_irqsave
2246  set_task_cpu(p, cpu)
2247  raw_spin_unlock_irqrestore
2250  If Value is more likely to compile time then set the &sched_info to 0
2254  on_cpu = 0
2256  must be macros to avoid header recursion hell
2258  Dynamic struct plist_node initializer
2259  RB_CLEAR_NODE
2262  put_cpu
2263  Returning 0
Caller
Function NameFunction description
copy_processCreate a new process