函数逻辑报告

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

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

函数名称: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

函数原型:static bool task_will_free_mem(struct task_struct *task)

返回类型:bool

参数:

类型参数名称
struct task_struct *task
811  mm等于mm
813  bool ret = true
820  如果非mm则返回:false
823  如果非__task_will_free_mem(task)则返回:false
830  如果st_bit - Determine whether a bit is set*@nr: bit number to test*@addr: Address to start counting from则返回:false
833  如果atomic_read( & *@mm_users: The number of users including userspace. * Use mmget()/mmget_not_zero()/mmput() to modify. When this * drops to 0 (i.e. when the task exits and there are no other * temporary reference holders), we also release a reference on *@mm_count (which )小于等于1则返回:true
841  _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
843  如果非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.则继续下一循环
845  如果same_thread_group(task, p)则继续下一循环
847  ret等于__task_will_free_mem(p)
848  如果非ret退出
851  _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()
853  返回:ret
调用者
名称描述
oom_kill_process
out_of_memory_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)