函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称:__oom_kill_process

函数原型:static void __oom_kill_process(struct task_struct *victim, const char *message)

返回类型:void

参数:

类型参数名称
struct task_struct *victim
const char *message
860  bool can_oom_reap = true
862  p等于The process p may have detached its own ->mm while exiting or through* use_mm(), but one or more of its subthreads may still have a valid* pointer. Return p, or any of its subthreads with a valid ->mm, with* task_lock() held.
863  如果非p
864  put_task_struct(victim)
865  返回
866  否则如果victim不等于p
867  get_task_struct(p)
868  put_task_struct(victim)
869  victim等于p
873  mm等于mm
874  mmgrab() - Pin a &struct mm_struct
877  Disable counters
878  memcg_memory_event_mm(mm, MEMCG_OOM_KILL)
885  do_send_sig_info(SIGKILL, SEND_SIG_PRIV, victim, PIDTYPE_TGID)
886  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).
887  打印错误信息("%s: Killed process %d (%s) total-vm:%lukB, anon-rss:%lukB, file-rss:%lukB, shmem-rss:%lukB, UID:%u pgtables:%lukB oom_score_adj:%hd\n", message, task_pid_nr(victim), comm, K( Total pages mapped ), K(per-process(per-mm_struct) statistics.), K(per-process(per-mm_struct) statistics.), K(per-process(per-mm_struct) statistics.), m_kuid - Create a uid from a kuid user-namespace pair.*@targ: The user namespace we want a uid in.*@kuid: The kernel internal uid to start with.* Map @kuid into the user-namespace specified by @targ and* return the resulting uid., mm_pgtables_bytes(mm) >> 10, oom_score_adj)
894  task_unlock(victim)
905  _read_lock() - mark the beginning of an RCU read-side critical section* When synchronize_rcu() is invoked on one CPU while other CPUs* are within RCU read-side critical sections, then the* synchronize_rcu() is guaranteed to block until after all the other
907  如果非ask->mm can be NULL if the task is the exited group leader. So to* determine whether the task is using a particular mm, we examine all the* task's threads: if one of those is using this mm then this task was also* using it.则继续下一循环
909  如果same_thread_group(p, victim)则继续下一循环
911  如果检查进程已初始化
912  can_oom_reap = false
913  设置内存位
914  打印信息("oom killer %d (%s) has mm pinned by %d (%s)\n", task_pid_nr(victim), comm, task_pid_nr(p), comm)
917  继续下一循环
923  如果此条件成立可能性小(为编译器优化)(flags & I am a kernel thread )则继续下一循环
925  do_send_sig_info(SIGKILL, SEND_SIG_PRIV, p, PIDTYPE_TGID)
927  _read_unlock() - marks the end of an RCU read-side critical section.* In most situations, rcu_read_unlock() is immune from deadlock.* However, in kernels built with CONFIG_RCU_BOOST, rcu_read_unlock()
929  如果can_oom_reapwake_oom_reaper(victim)
932  mmdrop(mm)
933  put_task_struct(victim)
调用者
名称描述
oom_kill_memcg_memberKill provided task unless it's secured by setting* oom_score_adj to OOM_SCORE_ADJ_MIN.
oom_kill_process