函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\oom_kill.c Create Date:2022-07-27 15:29:50
Last Modify:2022-05-23 13:16:41 Copyright©Brick
首页 函数Tree
注解内核,赢得工具下载SCCTEnglish

函数名称:_of_memory - kill the "best" process when we run out of memory*@oc: pointer to struct oom_control* If we run out of memory, we have the choice between either* killing a random task (bad), letting the system crash (worse)

函数原型:bool out_of_memory(struct oom_control *oc)

返回类型:bool

参数:

类型参数名称
struct oom_control *oc
1045  freed等于0
1047  如果oom_killer_disabled则返回:false
1050  如果非is_memcg_oom(oc)则
1051  blocking_notifier_call_chain( & oom_notify_list, 0, & freed)
1052  如果freed大于0则返回:true
1062  如果Checks whether the given task is dying or exiting and likely to* release its address space. This means that all threads and processes* sharing the same mm have to be killed or exiting.* Caller has to make sure that task->mm is stable (hold task_lock or
1063  mark_oom_victim - mark the given task as OOM victim*@tsk: task to mark* Has to be called with oom_lock held and never after* oom has been disabled already.* under task_lock or operate on the current).
1064  wake_oom_reaper(当前进程)
1065  返回:true
1075  如果Used to determine cpuset and node locality requirement 且非Used to determine cpuset and node locality requirement 按位与__GFP_FS的值且非is_memcg_oom(oc)则返回:true
1082  Used to print the constraint info. 等于Determine the type of allocation constraint.
1083  如果Used to print the constraint info. 不等于CONSTRAINT_MEMORY_POLICYUsed to determine mempolicy = NULL
1085  Determines whether the kernel must panic because of the panic_on_oom sysctl.
1087  如果非is_memcg_oom(oc)且sysctl_oom_kill_allocating_taskmm且非rn true if the task is not adequate as candidate victim task. m_cpuset_eligible() - check task eligiblity for kill*@start: task struct of which task to consider*@oc: pointer to struct oom_control* Task eligibility is determined by whether or not a candidate task, @tsk,* shares the same mempolicy nodes as current if oom_score_adj不等于/proc//oom_score_adj set to OOM_SCORE_ADJ_MIN disables oom killing for* pid.
1091  get_task_struct(当前进程)
1092  chosen等于当前进程
1093  oom_kill_process(oc, "Out of memory (oom_kill_allocating_task)")
1094  返回:true
1097  Simple selection loop. We choose the process with the highest number of* 'points'. In case scan was aborted, oc->chosen is set to -1.
1099  如果非chosen
1100  dump_header(oc, NULL)
1101  打印警告信息("Out of memory and no killable processes...\n")
1107  如果非rder == -1 means the oom kill is required by sysrq, otherwise only* for display purposes.且非is_memcg_oom(oc)则panic - halt the system*@fmt: The text string to print* Display a message, then perform cleanups.* This function never returns.
1110  如果(chosen && chosen != (void * ) - 1UL)则oom_kill_process(oc, !is_memcg_oom(oc) ? "Out of memory" : "Memory cgroup out of memory")
1113  返回:非非chosen
调用者
名称描述
pagefault_out_of_memoryThe pagefault handler calls here because it is out of memory, so kill a* memory-hogging task. If oom_lock is held by somebody else, a parallel oom* killing is already in progress so do nothing.
__alloc_pages_may_oom
mem_cgroup_out_of_memory