Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:mm\oom_kill.c Create Date:2022-07-28 14:06:39
Last Modify:2022-05-23 13:16:41 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:_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)

Proto:bool out_of_memory(struct oom_control *oc)

Type:bool

Parameter:

TypeParameterName
struct oom_control *oc
1045  freed = 0
1047  If oom_killer_disabled Then Return false
1050  If Not is_memcg_oom(oc) Then
1051  blocking_notifier_call_chain( & oom_notify_list, 0, & freed)
1052  If freed > 0 Then Return true
1062  If 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 Then
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(current process)
1065  Return true
1075  If Used to determine cpuset and node locality requirement && Not (Used to determine cpuset and node locality requirement & __GFP_FS) && Not is_memcg_oom(oc) Then Return true
1082  Used to print the constraint info. = Determine the type of allocation constraint.
1083  If Used to print the constraint info. != CONSTRAINT_MEMORY_POLICY Then Used to determine mempolicy = NULL
1085  Determines whether the kernel must panic because of the panic_on_oom sysctl.
1087  If Not is_memcg_oom(oc) && sysctl_oom_kill_allocating_task && mm && Not 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. Then
1091  get_task_struct(current process)
1092  chosen = current process
1093  oom_kill_process(oc, "Out of memory (oom_kill_allocating_task)")
1094  Return 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  If Not chosen Then
1100  dump_header(oc, NULL)
1101  pr_warn("Out of memory and no killable processes...\n")
1107  If Not rder == -1 means the oom kill is required by sysrq, otherwise only* for display purposes. && Not is_memcg_oom(oc) Then panic - halt the system*@fmt: The text string to print* Display a message, then perform cleanups.* This function never returns.
1110  If (chosen && chosen != (void * ) - 1UL) Then oom_kill_process(oc, !is_memcg_oom(oc) ? "Out of memory" : "Memory cgroup out of memory")
1113  Return Not Not chosen
Caller
NameDescribe
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